Skip to content

Commit

Permalink
Adjust log controller spec to only regard person paper trail entries
Browse files Browse the repository at this point in the history
  • Loading branch information
TheWalkingLeek committed Sep 19, 2023
1 parent 711da7c commit 82e918f
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions spec/controllers/person/log_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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 }

Expand All @@ -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 }

Expand All @@ -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 }
Expand All @@ -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
Expand Down

0 comments on commit 82e918f

Please sign in to comment.