Files
mozo-backend/spec/acceptance_steps/global_order_steps.rb
T
2015-09-17 17:46:33 +02:00

16 lines
809 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 product_orders: [{ 'product_id' => @product.id, 'quantity' => 2}], user: @user, first_order: true
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