Skip to content

Commit

Permalink
revert date changes in different specs and add some additional specs
Browse files Browse the repository at this point in the history
  • Loading branch information
njaeggi committed Aug 22, 2024
1 parent 1b96594 commit 28dc85f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
16 changes: 13 additions & 3 deletions spec/domain/invoices/sac_memberships/member_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,23 @@
let(:person) { context.people_with_membership_years.find(people(:mitglied).id) }

it "counts years correctly" do
roles(:mitglied).update_column(:created_at, "2015-01-20")
expect(subject.membership_years).to eq(9)
roles(:mitglied).update_column(:created_at, "2015-01-01")
expect(subject.membership_years).to eq(8)
end

it "is off by one in first year" do
roles(:mitglied).update_column(:created_at, date)
expect(subject.membership_years).to eq(2)
expect(subject.membership_years).to eq(0)
end

it "counts years correctly in second year" do
roles(:mitglied).update_column(:created_at, "2023-01-01")
expect(subject.membership_years).to eq(0)
end

it "counts years correctly in third year" do
roles(:mitglied).update_column(:created_at, "2022-01-01")
expect(subject.membership_years).to eq(1)
end
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,7 @@

context "last year without reduction" do
before do
roles(:mitglied).update!(created_at: Date.new(date.year - 24, 12, 31))
roles(:mitglied).update!(created_at: Date.new(date.year - 24, 1, 1))
end

it "generates positions without reduction" do
Expand Down

0 comments on commit 28dc85f

Please sign in to comment.