39 lines
1.4 KiB
Ruby
39 lines
1.4 KiB
Ruby
step "the list is marked as in need of help" do
|
|
@list.needs_help.should_not be true
|
|
@list.needs_help!
|
|
end
|
|
|
|
step "the list is marked as in need of payment" do
|
|
@list.needs_payment!
|
|
end
|
|
|
|
step "the user has an active list with a/an :order_status order" do |order_status|
|
|
@list = create :list, supplier: @supplier, table: @table, user_ids: [@user.id]
|
|
@product ||= create :product, supplier: @supplier, name: 'Beer', price: 2.34
|
|
@order = create :order, order_status.to_sym, supplier: @supplier, list: @list
|
|
@product_order = create :product_order, order: @order, product: @product, quantity: 2, price: 2.34
|
|
@user.reload
|
|
@user.active_list_id = @list.id
|
|
@user.save
|
|
case order_status.to_sym
|
|
when :placed then @supplier.increment_orders_placed_count!
|
|
when :active then @supplier.increment_orders_in_process_count!
|
|
end
|
|
end
|
|
|
|
step "the list changes to another table" do
|
|
@list.move_to_table! @other_table
|
|
end
|
|
|
|
step "the list should be marked as closed" do
|
|
@list.reload
|
|
@list.state.should == 'closed'
|
|
end
|
|
|
|
step 'a new order on a table in another section is created' do
|
|
# @new_section = create :section, title: 'Terrace', supplier: @supplier
|
|
# @new_table = create :table, number: 59, section: @new_section, supplier: @supplier
|
|
@new_list = create :list, section: @other_section, table: @other_table, supplier: @supplier, user_ids: [@user.id]
|
|
@new_order = @new_list.place_order(products: {@product.id => 3}, user: @user)
|
|
end
|