Fix flaky OrderSerializer spec

Make sure that completed payment is for an amount less that the order total
This commit is contained in:
Rob Harrington
2017-09-14 11:18:20 +10:00
parent 34b109cbb7
commit 393a4efbf6

View File

@@ -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