Skip to content

Commit

Permalink
Fix active_year_performance_spec
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-illi committed Oct 26, 2023
1 parent d0818ef commit fe904d3
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions spec/performance/active_year_performance_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@
let(:person) { people(:member) }

before :each do
person.roles.each {|role| role.really_destroy! }
Role.create!(person: person, group: group, created_at: 20.years.ago, deleted_at: 17.years.ago, type: 'Group::VereinMitglieder::Mitglied')
Role.create!(person: person, group: group, created_at: 15.years.ago, deleted_at: 13.years.ago, type: 'Group::VereinMitglieder::Mitglied')
Role.create!(person: person, group: group, created_at: 10.years.ago, deleted_at: 7.years.ago, type: 'Group::VereinMitglieder::Mitglied')
Role.create!(person: person, group: group, created_at: 5.years.ago, deleted_at: 3.years.ago, type: 'Group::VereinMitglieder::Mitglied')
Role.create!(person: person, group: group, created_at: 1.year.ago, deleted_at: nil, type: 'Group::VereinMitglieder::Mitglied')
end

def measure(max_time, &block)
Expand All @@ -33,13 +35,13 @@ def measure(max_time, &block)

it 'load active years' do
measure(FETCH_YEARS_TIME) do
expect(person.active_years).to be == 10
expect(person.active_years).to be == 15
end
end

it 'load prognostic active years' do
measure(FETCH_YEARS_TIME) do
expect(person.prognostic_active_years).to be == 11
expect(person.prognostic_active_years).to be == 16
end
end

Expand Down

0 comments on commit fe904d3

Please sign in to comment.