Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ PATH
measured (>= 2.0)
minitest (~> 5.14)
money-rails (~> 1.13)
mongoid (~> 7.4)
mongoid (>= 7.4, < 9)
mongoid-active_merchant (~> 0.2)
mongoid-audit_log (>= 0.6.0)
mongoid-document_path (~> 0.2)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def test_allows_the_request_when_admin_user

def test_does_not_allow_the_request_when_non_admin_user
# login
@user.update_attributes!(admin: false)
@user.update!(admin: false)
post storefront.login_path,
params: { email: @user.email, password: 'W3bl1nc!' }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def test_deletes_a_changeset
page = create_page(name: 'Foo')
release = create_release
release.as_current do
page.update_attributes!(name: 'Bar')
page.update!(name: 'Bar')
end

changeset = release.changesets.first
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def test_editing_comment_as_author

comment.reload
assert_equal('body', comment.body)
comment.update_attributes(author_id: current_user.id)
comment.update(author_id: current_user.id)

patch admin.commentable_comment_path(commentable.to_global_id, comment),
params: { comment: { body: 'different body' } }
Expand All @@ -116,7 +116,7 @@ def test_deleting_comment_as_author
delete admin.commentable_comment_path(commentable.to_global_id, comment)

assert_equal(1, Comment.count)
comment.update_attributes(author_id: current_user.id)
comment.update(author_id: current_user.id)

delete admin.commentable_comment_path(commentable.to_global_id, comment)
assert_equal(0, Comment.count)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def test_creating_blocks_without_publishing_authorization
assert_equal(flash[:error], I18n.t('workarea.admin.publish_authorization.unauthorized'))


content.update_attributes!(active: false)
content.update!(active: false)

post admin.content_area_blocks_path(content, area),
params: { block: { type_id: :html, data: { 'html' => 'foo' } } }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def test_save_publish

assert(category.reload.active?)

category.update_attributes!(active: false)
category.update!(active: false)

post admin.save_publish_create_catalog_category_path(category),
params: { activate: 'new_release', release: { name: '' } }
Expand All @@ -86,7 +86,7 @@ def test_save_publish
release.as_current { assert(category.reload.active?) }

release = create_release
category.update_attributes!(active: false)
category.update!(active: false)

post admin.save_publish_create_catalog_category_path(category),
params: { activate: release.id }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ def test_save_publish

assert(product.reload.active?)

product.update_attributes!(active: false)
product.update!(active: false)

post admin.save_publish_create_catalog_product_path(product),
params: { activate: 'new_release', release: { name: '' } }
Expand All @@ -202,7 +202,7 @@ def test_save_publish
release.as_current { assert(product.reload.active?) }

release = create_release
product.update_attributes!(active: false)
product.update!(active: false)

post admin.save_publish_create_catalog_product_path(product),
params: { activate: release.id }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def test_save_publish

assert(page.reload.active?)

page.update_attributes!(active: false)
page.update!(active: false)

post admin.save_publish_create_content_page_path(page),
params: { activate: 'new_release', release: { name: '' } }
Expand All @@ -86,7 +86,7 @@ def test_save_publish
release.as_current { assert(page.reload.active?) }

release = create_release
page.update_attributes!(active: false)
page.update!(active: false)

post admin.save_publish_create_content_page_path(page),
params: { activate: release.id }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ def test_save_publish

assert(discount.reload.active?)

discount.update_attributes!(active: false)
discount.update!(active: false)

post admin.save_publish_create_pricing_discount_path(discount),
params: { activate: 'new_release', release: { name: '' } }
Expand All @@ -236,7 +236,7 @@ def test_save_publish
release.as_current { assert(discount.reload.active?) }

release = create_release
discount.update_attributes!(active: false)
discount.update!(active: false)

post admin.save_publish_create_pricing_discount_path(discount),
params: { activate: release.id }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def test_create
releasable = create_page(name: 'Foo')
release = create_release

release.as_current { releasable.update_attributes!(name: 'Bar') }
release.as_current { releasable.update!(name: 'Bar') }
release.changesets.create!(releasable: Catalog::Product.new) # test missing releasable

post admin.release_undos_path(release),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ def test_creating_without_a_password
end

def test_creating_an_admin_without_permissions_management
admin_user.update_attributes!(
admin_user.update!(
super_admin: false,
admin: true,
people_access: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def test_adding_a_product_without_publishing_authorization
assert_redirected_to(admin.featured_product_path(category.to_global_id))
assert_equal(flash[:error], I18n.t('workarea.admin.publish_authorization.unauthorized'))

category.update_attributes!(active: false)
category.update!(active: false)

post admin.add_featured_product_path(category.to_global_id),
params: { product_id: product.id }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def test_can_create_an_impersonation
end

def test_does_not_allow_impersonating_another_admin
@user.update_attributes!(admin: true)
@user.update!(admin: true)

assert_raises Admin::InvalidImpersonation do
post admin.impersonations_path, params: { user_id: @user.id }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def test_redirects_if_you_do_not_have_permissions
end

def test_allows_if_you_do_have_permissions
@user.update_attributes!(catalog_access: true)
@user.update!(catalog_access: true)
get admin.catalog_products_path
assert(response.ok?)
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ def test_calendar_feed

old_token = user.token

user.update_attributes!(admin: false)
user.update_attributes!(admin: true, releases_access: true)
user.update!(admin: false)
user.update!(admin: true, releases_access: true)

get admin.calendar_feed_releases_path(token: old_token)
assert_response :unauthorized
Expand Down Expand Up @@ -91,8 +91,8 @@ def test_saving_release_during_time_based_previewing
second = create_release(publish_at: 2.days.from_now)

product = create_product(name: 'Foo', description: 'One')
first.as_current { product.update_attributes!(name: 'Bar', description: 'Two') }
second.as_current { product.update_attributes!(name: 'Baz') }
first.as_current { product.update!(name: 'Bar', description: 'Two') }
second.as_current { product.update!(name: 'Baz') }

post admin.release_session_path, params: { release_id: second.id }
patch admin.catalog_product_path(product), params: { product: { name: 'Qux' } }
Expand Down Expand Up @@ -132,8 +132,8 @@ def test_working_on_releases_that_publish_at_the_same_time
second = create_release(publish_at: publish_at)

product = create_product(name: 'Foo', description: 'One')
first.as_current { product.update_attributes!(name: 'Bar', description: 'Two') }
second.as_current { product.update_attributes!(name: 'Baz') }
first.as_current { product.update!(name: 'Bar', description: 'Two') }
second.as_current { product.update!(name: 'Baz') }

post admin.release_session_path, params: { release_id: second.id }
patch admin.catalog_product_path(product), params: { product: { name: 'Qux' } }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def test_updates_a_user
def test_permissions_management
user = create_user

admin_user.update_attributes!(
admin_user.update!(
super_admin: false,
admin: true,
people_access: true,
Expand Down Expand Up @@ -94,7 +94,7 @@ def test_permissions_management
refute(user.people_access)
refute(user.marketing_access)

admin_user.update_attributes!(permissions_manager: true)
admin_user.update!(permissions_manager: true)
get admin.permissions_user_path(create_user)
assert(response.ok?)

Expand Down
4 changes: 2 additions & 2 deletions admin/test/system/workarea/admin/data_files_system_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def test_viewing_exports
started_at: 1.hour.ago,
file_type: 'csv'
)
export_one.update_attributes!(
export_one.update!(
file: export_one.tempfile.tap(&:close),
completed_at: Time.current
)
Expand All @@ -88,7 +88,7 @@ def test_viewing_exports
started_at: 2.hour.ago,
file_type: 'json'
)
export_two.update_attributes!(
export_two.update!(
file: export_two.tempfile.tap(&:close),
completed_at: Time.current
)
Expand Down
2 changes: 1 addition & 1 deletion admin/test/system/workarea/admin/help_system_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def test_a_help_admin_can_manage_help_articles
visit admin.help_index_path
assert(page.has_no_content?('Add New Article'))

admin_user.update_attributes!(help_admin: true)
admin_user.update!(help_admin: true)

visit admin.help_index_path
click_link 'Add New Article'
Expand Down
10 changes: 5 additions & 5 deletions admin/test/system/workarea/admin/releases_system_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,11 @@ def test_viewing_release_changes
content.blocks.create!(area: 'test', type: 'html', data: { 'foo' => 'bar' })

Release.first.as_current do
product.update_attributes!(name: 'Changed Product')
product.variants.first.update_attributes!(active: false)
pricing_sku.update_attributes!(tax_code: '002')
discount.update_attributes!(product_ids: [product.id])
content.blocks.first.update_attributes!(data: { 'foo' => 'baz' })
product.update!(name: 'Changed Product')
product.variants.first.update!(active: false)
pricing_sku.update!(tax_code: '002')
discount.update!(product_ids: [product.id])
content.blocks.first.update!(data: { 'foo' => 'baz' })
end

visit admin.release_path(Release.first)
Expand Down
2 changes: 1 addition & 1 deletion admin/test/system/workarea/admin/search_system_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class SearchSystemTest < SystemTest
create_menu(name: 'Foo Menu')

Release.with_current(release.id) do
product.update_attributes!(name: 'Updated Foo Product 1')
product.update!(name: 'Updated Foo Product 1')
end
end

Expand Down
2 changes: 1 addition & 1 deletion admin/test/system/workarea/admin/trash_system_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def test_restore_permission
visit admin.trash_index_path
assert(page.has_no_content?(t('workarea.admin.activities.restore')))

user.update_attributes(can_restore: true)
user.update(can_restore: true)

visit admin.trash_index_path

Expand Down
24 changes: 12 additions & 12 deletions admin/test/view_models/workarea/admin/changeset_view_model_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def test_current_change
end

def test_new_value_for
@changeset.update_attributes!(
@changeset.update!(
changeset: { 'name' => { I18n.locale.to_s => 'foo' }}
)

Expand All @@ -54,22 +54,22 @@ def test_new_value_for
def test_old_value_for
Sidekiq::Testing.fake! # setting publish_at will schedule the job, which runs inline

@release.update_attributes!(publish_at: nil)
@releasable.update_attributes!(name: 'foo')
@release.as_current { @releasable.update_attributes!(name: 'bar') }
@release.update!(publish_at: nil)
@releasable.update!(name: 'foo')
@release.as_current { @releasable.update!(name: 'bar') }
changeset = @releasable.changesets.first

view_model = ChangesetViewModel.wrap(changeset)
assert_equal('foo', view_model.old_value_for('name'))
assert_equal('foo', @releasable.name)

@release.update_attributes!(publish_at: 1.week.from_now)
@release.update!(publish_at: 1.week.from_now)
view_model = ChangesetViewModel.wrap(changeset.reload)
assert_equal('foo', view_model.old_value_for('name'))
assert_equal('foo', @releasable.name)

previous = create_release(publish_at: 1.day.from_now)
previous.as_current { @releasable.update_attributes!(name: 'baz') }
previous.as_current { @releasable.update!(name: 'baz') }

view_model = ChangesetViewModel.wrap(changeset.reload)
assert_equal('baz', view_model.old_value_for('name'))
Expand All @@ -82,32 +82,32 @@ def test_old_value_for
assert_equal('baz', view_model.old_value_for('name'))
assert_equal('foo', @releasable.name)

@release.update_attributes!(publish_at: nil)
@release.update!(publish_at: nil)
view_model = ChangesetViewModel.wrap(changeset.reload)
assert_equal('foo', view_model.old_value_for('name'))
assert_equal('foo', @releasable.name)

undo.update_attributes!(publish_at: 1.week.from_now)
undo.update!(publish_at: 1.week.from_now)
view_model = ChangesetViewModel.wrap(changeset.reload)
assert_equal('foo', view_model.old_value_for('name'))
assert_equal('foo', @releasable.name)

undo.update_attributes!(publish_at: 1.week.from_now)
undo.update!(publish_at: 1.week.from_now)
view_model = ChangesetViewModel.wrap(undo_changeset.reload)
assert_equal('baz', view_model.old_value_for('name'))
assert_equal('foo', @releasable.name)

@release.update_attributes!(publish_at: 1.day.from_now)
@release.update!(publish_at: 1.day.from_now)
view_model = ChangesetViewModel.wrap(undo_changeset.reload)
assert_equal('bar', view_model.old_value_for('name'))
assert_equal('foo', @releasable.name)

undo.update_attributes!(publish_at: nil)
undo.update!(publish_at: nil)
view_model = ChangesetViewModel.wrap(undo_changeset.reload)
assert_equal('bar', view_model.old_value_for('name'))
assert_equal('foo', @releasable.name)

@release.update_attributes!(publish_at: nil)
@release.update!(publish_at: nil)
view_model = ChangesetViewModel.wrap(undo_changeset.reload)
assert_equal('bar', view_model.old_value_for('name'))
assert_equal('foo', @releasable.name)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def test_open_graph_asset
view_model = ContentViewModel.wrap(content)
assert_equal(default_asset, view_model.open_graph_asset)

content.update_attributes(open_graph_asset_id: create_asset.id)
content.update(open_graph_asset_id: create_asset.id)
view_model = ContentViewModel.wrap(content)
og_asset = view_model.open_graph_asset

Expand Down
Loading
Loading