Stock validator test
This commit is contained in:
parent
41140e0784
commit
41e8c113ed
1 changed files with 12 additions and 0 deletions
12
test/integration/stock_validator_test.rb
Normal file
12
test/integration/stock_validator_test.rb
Normal file
|
@ -0,0 +1,12 @@
|
|||
require 'test_helper'
|
||||
|
||||
class StockValidatorTest < ActiveSupport::TestCase
|
||||
test "form gives error when product out of stock" do
|
||||
order = users(:benji).orders.build
|
||||
order.order_items.build(product: products(:cola), count: 10)
|
||||
|
||||
order.save
|
||||
|
||||
assert_includes order.errors[:base], "There is not enough stock for your order of the following products: Cola"
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue