diff --git a/test/functional/homes_controller_test.rb b/test/functional/homes_controller_test.rb index 2005afc65e..6cd96cf2c5 100644 --- a/test/functional/homes_controller_test.rb +++ b/test/functional/homes_controller_test.rb @@ -260,11 +260,9 @@ class HomesControllerTest < ActionController::TestCase test 'recently added and download should include snapshot' do person = FactoryBot.create(:person) snapshot1 = FactoryBot.create(:investigation, policy: FactoryBot.create(:publicly_viewable_policy), - title: 'inv with snap', contributor: person, creators: [person]).create_snapshot - snapshot1.update_attribute(:title, 'My snapshot') + title: 'inv with snap', contributor: person, creators: [person]).create_snapshot(title: 'My snapshot') snapshot2 = FactoryBot.create(:assay, policy: FactoryBot.create(:publicly_viewable_policy), - title: 'assay with snap', contributor: person, creators: [person]).create_snapshot - snapshot2.update_attribute(:title, 'My other snapshot') + title: 'assay with snap', contributor: person, creators: [person]).create_snapshot(title: 'My other snapshot') assert_difference 'ActivityLog.count', 2 do FactoryBot.create(:activity_log, action: 'create', activity_loggable: snapshot1, created_at: 1.day.ago, culprit: person.user) FactoryBot.create(:activity_log, action: 'download', activity_loggable: snapshot2, created_at: 1.day.ago, culprit: person.user) @@ -380,8 +378,7 @@ class HomesControllerTest < ActionController::TestCase sop = FactoryBot.create :sop, title: 'A new sop', contributor: person, policy: FactoryBot.create(:public_policy) assay = FactoryBot.create :assay, title: 'A new assay', contributor: person, policy: FactoryBot.create(:public_policy), creators: [person] - snapshot = assay.create_snapshot - snapshot.update_attribute(:title, 'My snapshot') + snapshot = assay.create_snapshot(title: 'My snapshot') FactoryBot.create :activity_log, activity_loggable: df, controller_name: 'data_files', culprit: person.user FactoryBot.create :activity_log, activity_loggable: sop, controller_name: 'sops', culprit: person.user diff --git a/test/unit/helpers/homes_helper_test.rb b/test/unit/helpers/homes_helper_test.rb index 984982b04c..c6a01cc8a7 100644 --- a/test/unit/helpers/homes_helper_test.rb +++ b/test/unit/helpers/homes_helper_test.rb @@ -61,11 +61,9 @@ def setup test 'should handle snapshots for download and recently added' do person = FactoryBot.create(:person) snapshot1 = FactoryBot.create(:investigation, policy: FactoryBot.create(:publicly_viewable_policy), - contributor: person, creators: [person]).create_snapshot - snapshot1.update_attribute(:title, 'My snapshot') + contributor: person, creators: [person]).create_snapshot(title: 'My snapshot') snapshot2 = FactoryBot.create(:assay, policy: FactoryBot.create(:publicly_viewable_policy), - contributor: person, creators: [person]).create_snapshot - snapshot2.update_attribute(:title, 'My other snapshot') + contributor: person, creators: [person]).create_snapshot(title: 'My other snapshot') FactoryBot.create(:activity_log, action: 'create', activity_loggable: snapshot1, created_at: 1.day.ago, culprit: person.user) FactoryBot.create(:activity_log, action: 'download', activity_loggable: snapshot2, created_at: 1.day.ago, culprit: person.user) @@ -74,8 +72,6 @@ def setup assert_equal 1, added_hash.count added = added_hash.first - pp added_hash - pp added assert_equal 'Snapshot', added[:type] assert_equal snapshot1.title.to_s, added[:title] assert_equal investigation_snapshot_path(snapshot1.resource, snapshot1), added[:url]