Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion core/app/models/spree/tax_rate.rb
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def self.store_pre_tax_amount(item, rates)
pre_tax_amount /= (1 + included_rates.map(&:amount).sum)
end

item.update_column(:pre_tax_amount, pre_tax_amount.round(2))
item.update_column(:pre_tax_amount, pre_tax_amount)
end

# Creates necessary tax adjustments for the order.
Expand Down
17 changes: 10 additions & 7 deletions core/spec/models/spree/tax/taxation_integration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@
end

it 'has a constant amount pre tax' do
expect(line_item.pre_tax_amount).to eq(18.69)
expect(line_item.discounted_amount - line_item.included_tax_total).to eq(18.69)
end
end

Expand Down Expand Up @@ -294,7 +294,7 @@
end

it 'has a constant amount pre tax' do
expect(line_item.pre_tax_amount).to eq(25.21)
expect(line_item.discounted_amount - line_item.included_tax_total).to eq(25.21)
end
end

Expand Down Expand Up @@ -338,7 +338,7 @@

it 'has a constant amount pre tax' do
pending 'but it changes to 8.06, because Spree thinks both VATs apply'
expect(line_item.pre_tax_amount).to eq(8.40)
expect(line_item.discounted_amount - line_item.included_tax_total).to eq(8.40)
end
end

Expand Down Expand Up @@ -397,7 +397,7 @@
end

it 'has a constant amount pre tax' do
expect(line_item.pre_tax_amount).to eq(18.69)
expect(line_item.discounted_amount - line_item.included_tax_total).to eq(18.69)
end
end
end
Expand Down Expand Up @@ -433,7 +433,8 @@
end

it 'has a constant amount pre tax' do
expect(line_item.pre_tax_amount).to eq(18.69)
pending 'But it has a discount that abuses the additional tax total'
expect(line_item.discounted_amount - line_item.included_tax_total).to eq(18.69)
end

context 'an order with a book and a shipment' do
Expand Down Expand Up @@ -480,7 +481,8 @@
end

it 'has a constant amount pre tax' do
expect(line_item.pre_tax_amount).to eq(25.21)
pending 'But it has a discount that abuses the additional tax total'
expect(line_item.discounted_amount - line_item.included_tax_total).to eq(25.21)
end

context 'an order with a sweater and a shipment' do
Expand Down Expand Up @@ -527,7 +529,8 @@
end

it 'has a constant amount pre tax' do
expect(line_item.pre_tax_amount).to eq(8.40)
pending 'But it has a discount that abuses the additional tax total'
expect(line_item.discounted_amount - line_item.included_tax_total).to eq(8.40)
end
end

Expand Down