Skip to content

Commit

Permalink
add one more scenario
Browse files Browse the repository at this point in the history
  • Loading branch information
annvelents committed Oct 4, 2024
1 parent 5c16c1e commit dd49ae5
Show file tree
Hide file tree
Showing 4 changed files with 337 additions and 127 deletions.
2 changes: 1 addition & 1 deletion app/models/credit_note.rb
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def sub_total_excluding_taxes_amount_cents
alias_method :sub_total_excluding_taxes_amount_currency, :currency

def precise_total
items.sum(&:precise_amount_cents) + precise_taxes_amount_cents
items.sum(&:precise_amount_cents) - precise_coupons_adjustment_amount_cents + precise_taxes_amount_cents
end

def taxes_rounding_adjustment
Expand Down
5 changes: 1 addition & 4 deletions spec/models/credit_note_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
RSpec.describe CreditNote, type: :model do
subject(:credit_note) do
create :credit_note, credit_amount_cents: 11000, total_amount_cents: 11000, taxes_amount_cents: 1000,
taxes_rate: 10.0, precise_taxes_amount_cents: 1000
taxes_rate: 10.0, precise_taxes_amount_cents: 1000
end

let(:item) { create(:credit_note_item, credit_note:, precise_amount_cents: 10000, amount_cents: 1000) }
Expand Down Expand Up @@ -357,7 +357,6 @@
end
end


context 'when taxes are not precise' do
subject(:credit_note) do
create :credit_note, credit_amount_cents: 8200, total_amount_cents: 8200, taxes_amount_cents: 1367,
Expand Down Expand Up @@ -389,5 +388,3 @@
end
end
end


Loading

0 comments on commit dd49ae5

Please sign in to comment.