tap/test/integration/stock_validator_test.rb

13 lines
376 B
Ruby
Raw Normal View History

2015-03-04 18:18:47 +01:00
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