16 lines
753 B
Ruby
16 lines
753 B
Ruby
step "A new order is placed" do
|
|
@user ||= create :user
|
|
@list = create :list, state: 'active', supplier: @supplier, table: @table, section: @section, user_ids: [@user.id]
|
|
@order = @list.place_order products: {@product.id => 2}, user: @user
|
|
end
|
|
|
|
step "an order with :quantity products :product_name should have been created" do |quantity, product_name|
|
|
concerning_product = Product.find_by_name(product_name)
|
|
ProductOrder.find_by_quantity_and_product_id(quantity.to_i, concerning_product.id).should be_present
|
|
end
|
|
|
|
step "no order for the product :product_name should have been created" do |product_name|
|
|
concerning_product = Product.find_by_name(product_name)
|
|
ProductOrder.find_by_product_id(concerning_product.id).should_not be_present
|
|
end
|