Skip to content

Commit

Permalink
fix broken tests
Browse files Browse the repository at this point in the history
  • Loading branch information
annvelents committed Oct 4, 2024
1 parent 2507dad commit c4e63fb
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions spec/models/credit_note_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@

let(:item) { create(:credit_note_item, credit_note:, precise_amount_cents: 10000, amount_cents: 1000) }

before do
item
credit_note.reload
end

it_behaves_like 'paper_trail traceable'

it { is_expected.to have_many(:integration_resources) }
Expand Down Expand Up @@ -253,16 +248,23 @@
end
end

describe '#sub_total_excluding_taxes_amount_cents' do
it 'returs the total amount without the taxes' do
expect(credit_note.sub_total_excluding_taxes_amount_cents)
.to eq(credit_note.items.sum(&:precise_amount_cents) - credit_note.precise_coupons_adjustment_amount_cents)
context 'when calculating depends on related items' do
before do
item
credit_note.reload
end
end

describe '#precise_total' do
it 'returns the total precise amount including precise taxes' do
expect(credit_note.precise_total).to eq(11000)
describe '#sub_total_excluding_taxes_amount_cents' do
it 'returs the total amount without the taxes' do
expect(credit_note.sub_total_excluding_taxes_amount_cents)
.to eq(credit_note.items.sum(&:precise_amount_cents) - credit_note.precise_coupons_adjustment_amount_cents)
end
end

describe '#precise_total' do
it 'returns the total precise amount including precise taxes' do
expect(credit_note.precise_total).to eq(11000)
end
end
end

Expand Down Expand Up @@ -367,6 +369,7 @@

before do
item
credit_note.reload
end

describe '#precise_total' do
Expand Down

0 comments on commit c4e63fb

Please sign in to comment.