We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e6cfb13 commit 03cd071Copy full SHA for 03cd071
1 file changed
spec/models/purchase_spec.rb
@@ -72,6 +72,13 @@
72
expect(p).not_to be_valid
73
end
74
75
+ it "is not valid if any line item has negative quantity" do
76
+ item = create(:item)
77
+ p = build(:purchase)
78
+ p.line_items.build(item_id: item.id, quantity: -1)
79
+ expect(p).not_to be_valid
80
+ end
81
+
82
it "is valid if all categories are positive and add up to the total" do
83
d = build(:purchase, amount_spent_in_cents: 1150,
84
amount_spent_on_diapers_cents: 200,
0 commit comments