Files
mozo-backend/spec/acceptance_steps/users/changing_table_steps.rb
T
2015-10-06 17:20:56 +02:00

60 lines
2.3 KiB
Ruby

step "there is another table" do
@other_table = create :table, number: 89, section: @section, supplier: @supplier
end
step "the user should see a popup asking the user if he would like to change table" do
move_table_body = page.evaluate_script "t('move_table.confirmation_body', #{@other_table.attributes.to_json})"
move_table_body.should be_present
page.should have_content move_table_body
end
step "the user indicates in the popup that he wants to change the table" do
find('.modal-confirm').click
end
step "the user should see the supplier menu having the other table as base" do
ember_route_should_be '/active-list'
product_order = @list.orders.first.product_orders.first
page.should have_content "#{product_order.quantity} x #{product_order.product_name}"
all('.table-number').map(&:text).uniq.should == ["# #{@other_table.number.to_s}"]
end
step "the user list should have been moved to the other table" do
@user.active_list.table.should == @other_table
@other_table.active_list.should == @user.active_list
@table.active_list.should_not be_present
end
step "there is another table with an active list of another user" do
step "there is another table"
step 'there is another user'
@other_user_list = List.from_table @other_table, @other_user
end
step "the user scans a QR code of another not occupied table" do
when_ember_is_ready do
page.execute_script %|MozoUser.__container__.lookup('route:application').send('selectQr', {_id: "#{@other_table.id}"})|
end
#page.execute_script "Quser.actions_for_table({table_id: '#{@other_table.id}'})"
end
step "the user scans a QR code of another occupied table" do
# same as not, since this is just a scan action. Whether the table
# is occupied is a responsibility of other steps
step "the user scans a QR code of another not occupied table"
end
step "the user should see a popup telling him that the table is already occupied" do
table_occupied_body = page.evaluate_script "t('messages.table_is_occupied')"
table_occupied_body.should be_present
page.should have_content table_occupied_body
end
step "the user list should not have been moved to the other table" do
@user.active_list.table.should == @table
@table.active_list.should == @user.active_list
@other_table.active_list.user_ids.should_not include @user.id
end