mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Fix flaky OrderSerializer spec
Make sure that completed payment is for an amount less that the order total
This commit is contained in:
@@ -4,7 +4,7 @@ describe Api::OrderSerializer do
|
||||
let(:serializer) { Api::OrderSerializer.new order }
|
||||
let(:order) { create(:completed_order_with_totals) }
|
||||
|
||||
let!(:completed_payment) { create(:payment, order: order, state: 'completed', amount: 43.21) }
|
||||
let!(:completed_payment) { create(:payment, order: order, state: 'completed', amount: order.total - 1) }
|
||||
let!(:payment) { create(:payment, order: order, state: 'checkout', amount: 123.45) }
|
||||
|
||||
it "serializes an order" do
|
||||
@@ -12,6 +12,7 @@ describe Api::OrderSerializer do
|
||||
end
|
||||
|
||||
it "convert the state attributes to translatable keys" do
|
||||
# byebug if serializer.to_json =~ /balance_due/
|
||||
expect(serializer.to_json).to match "complete"
|
||||
expect(serializer.to_json).to match "balance_due"
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user