From 82e918f65321cd13b4a2776470811ce93a6fa33a Mon Sep 17 00:00:00 2001 From: Nils Rauch Date: Tue, 19 Sep 2023 09:56:10 +0200 Subject: [PATCH] Adjust log controller spec to only regard person paper trail entries --- spec/controllers/person/log_controller_spec.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/spec/controllers/person/log_controller_spec.rb b/spec/controllers/person/log_controller_spec.rb index 1933db7..4c74141 100644 --- a/spec/controllers/person/log_controller_spec.rb +++ b/spec/controllers/person/log_controller_spec.rb @@ -23,7 +23,7 @@ end it 'shows 0 versions if none are present' do - expect(PaperTrail::Version.count).to be 0 + expect(PaperTrail::Version.where(main_type: Person.sti_name).count).to be 0 get :index, params: { group_id: group.id, id: person.id } @@ -35,7 +35,7 @@ person.nickname = Faker::Superhero.name person.save! end - expect(PaperTrail::Version.count).to eq 10 + expect(PaperTrail::Version.where(main_type: Person.sti_name).count).to eq 10 get :index, params: { group_id: group.id, id: person.id } @@ -50,8 +50,8 @@ end travel_back - expect(PaperTrail::Version.count).to eq 10 - expect(PaperTrail::Version.where(created_at: 3.months.ago..DateTime.current).count).to eq 2 + expect(PaperTrail::Version.where(main_type: Person.sti_name).count).to eq 10 + expect(PaperTrail::Version.where(main_type: Person.sti_name, created_at: 3.months.ago..DateTime.current).count).to eq 2 expect(Settings.people.visible_log_months).to eq 3 get :index, params: { group_id: group.id, id: person.id } @@ -67,8 +67,8 @@ end travel_back - expect(PaperTrail::Version.count).to eq 10 - expect(PaperTrail::Version.where(created_at: 3.months.ago..DateTime.current).count).to eq 2 + expect(PaperTrail::Version.where(main_type: Person.sti_name).count).to eq 10 + expect(PaperTrail::Version.where(main_type: Person.sti_name, created_at: 3.months.ago..DateTime.current).count).to eq 2 prev_setting, Settings.people.visible_log_months = Settings.people.visible_log_months, nil expect(Settings.people.visible_log_months).to be_nil