mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-20 00:37:26 +00:00
Add #vouchers, return an array of voucher adjustments
This commit is contained in:
committed by
Maikel Linke
parent
9b680e1a92
commit
3ec58d8791
@@ -1430,4 +1430,21 @@ describe Spree::Order do
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "#vouchers" do
|
||||
let(:voucher) { Voucher.create(code: 'new_code', enterprise: order.distributor) }
|
||||
|
||||
context "when no voucher adjustment" do
|
||||
it 'returns an empty array' do
|
||||
expect(order.vouchers).to eq([])
|
||||
end
|
||||
end
|
||||
|
||||
it "returns an array of voucher adjusment" do
|
||||
order.save!
|
||||
expected_adjustments = Array.new(2) { voucher.create_adjustment(voucher.code, order) }
|
||||
|
||||
expect(order.vouchers).to eq(expected_adjustments)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user