For some reason in rails 4/spree 2.1 setting the line item as adjustable on the adjustment is not enough to populate line_item.adjustments. Here we make this assignment explicit fixing the spec in rails 4

This commit is contained in:
Luis Ramos
2020-03-03 15:04:51 +00:00
parent 829a73c58d
commit 1382bb3c6b

View File

@@ -40,10 +40,13 @@ module Spree
describe "finding line items with and without tax" do
let(:tax_rate) { create(:tax_rate, calculator: Spree::Calculator::DefaultTax.new) }
let!(:adjustment1) { create(:adjustment, adjustable: li1, originator: tax_rate, label: "TR", amount: 123, included_tax: 10.00) }
let!(:adjustment2) { create(:adjustment, adjustable: li1, originator: tax_rate, label: "TR", amount: 123, included_tax: 10.00) }
let!(:adjustment1) { create(:adjustment, originator: tax_rate, label: "TR", amount: 123, included_tax: 10.00) }
before { li1; li2 }
before do
li1
li2
li1.adjustments << adjustment1
end
it "finds line items with tax" do
expect(LineItem.with_tax).to eq([li1])