End of day commit

This commit is contained in:
2013-10-16 18:22:29 +02:00
parent 2f41560591
commit b5a84a2858
26 changed files with 46239 additions and 58 deletions
@@ -0,0 +1,49 @@
Feature: Supplier section view
@javascript
Scenario: the section view displays tables and keeps their status information
Given there is an active list and order
And I am signed in as supplier
When I visit the supplier section path
Then the section table should be positioned in the section
And the section table should be marked as having an active order
And the section table should be marked as occupied
And the section table should not be marked as in need of help
When the list is marked as in need of help
# waiting here only needed in old style implementation
And I wait 1 second
Then the section table should be marked as in need of help
When I click on section table as a supplier
Then A popup having table options should appear in supplier section area
When I click on the mark list as helped in the section table popup as supplier
And I wait 1 second
Then the section table should not be marked as in need of help
And the section table popup should no longer have the mark list as helped button
When the list is marked as in need of payment
Then the section table should be marked as in need of payment
When I click on the close list button in the section table table popup
And I wait 1 second
Then the section table should not have any active list markings anymore
And the list should be marked as closed
#@javascript
@broken
Scenario: Selecting a specific section limits the result to the lists and orders of those sections
Given there is an active list and order
And I am signed in as supplier
And a new order on a table in another section is created
Then I should see the list and the new list
And I should see the order and the new order
When I select the section in the supplier dashboard
Then I should see the list and order but not the new list and new order
When I select the new section in the supplier dashboard
Then I should see the new list and new order but not the list and order
When I reset the section selector in the supplier dashboard
Then I should see the list and the new list
And I should see the order and the new order
@@ -1,5 +1,5 @@
step 'there is a confirmed and open supplier' do
@supplier_password = 'secret1'
@supplier = create :supplier, email: 'supplier@qwaiter.com', password: @supplier_password, confirmation_token: 'abc', confirmed_at: Time.now.utc, open: true
@section = create :section, title: 'Room', supplier: @supplier
@section = create :section, title: 'Room', supplier: @supplier, width: 8, height: 8
end
@@ -1,7 +1,7 @@
step "there is an active list and order" do
@user ||= create :user
step 'there is a confirmed and open supplier'
@table = create :table, supplier: @supplier, section: @section
@table = create :table, supplier: @supplier, section: @section, position_x: 2, position_y: 2
@section.should be_present
@list = create :list, state: 'active', supplier: @supplier, table: @table, section: @section, user_ids: [@user.id]
@product = create :product, price: 2.22, supplier: @supplier
@@ -5,3 +5,7 @@ end
step "I visit the supplier root path" do
visit '/supplier' unless page.current_path == '/supplier'
end
step "I visit the supplier section path" do
visit "/supplier/sections/#{@section.id}"
end
@@ -0,0 +1,66 @@
step "the section table should be positioned in the section" do
table = page.find(".section-table-#{@table.id}")
left = table['style'].to_s.match(/left:(\d+)/)
left.should be_present
left[1].to_i.should > 10
top = table['style'].to_s.match(/top:(\d+)/)
top.should be_present
top[1].to_i.should > 10
end
step "the section table should be marked as having an active order" do
table = page.find(".section-table-#{@table.id}")
table['class'].should include 'active_order'
end
step "the section table should be marked as occupied" do
table = page.find(".section-table-#{@table.id}")
table['class'].should include 'occupied'
end
step "the section table should be marked as in need of help" do
table = page.find(".section-table-#{@table.id}")
table['class'].should include 'needs_help'
end
step "the section table should not be marked as in need of help" do
table = page.find(".section-table-#{@table.id}")
table['class'].should_not include 'needs_help'
end
step "I click on section table as a supplier" do
table = page.find(".section-table-#{@table.id}")
table.click
end
step "the section table should be marked as in need of payment" do
page.should have_selector(".section-table-#{@table.id}.needs_payment")
end
step "A popup having table options should appear in supplier section area" do
page.should have_selector(".table-actions-#{@table.id}")
end
step "I click on the mark list as helped in the section table popup as supplier" do
btn = page.find(".list-is-helped-button-#{@list.id}")
btn.click
end
step "the section table popup should no longer have the mark list as helped button" do
page.should_not have_selector(".list-is-helped-button-#{@list.id}")
end
step "I click on the close list button in the section table table popup" do
table = page.find(".section-table-#{@table.id}")
table.click
page.find(".table-actions-#{@table.id} .close-list").click
end
step "the section table should not have any active list markings anymore" do
table = page.find(".section-table-#{@table.id}")
css_class = table['class']
css_class.should_not include 'needs_help'
css_class.should_not include 'occupied'
css_class.should_not include 'active_order'
css_class.should_not include 'needs_payment'
end
+2 -1
View File
@@ -33,11 +33,12 @@ RSpec.configure do |config|
config.mock_with :rspec
config.include FactoryGirl::Syntax::Methods
config.include FactoryAttributesFor
config.include Devise::TestHelpers, :type => :controller
config.include Devise::TestHelpers, type: :controller
config.include EndWithMatcher
config.include Features::BasicHelpers, type: :feature
#config.use_transactional_fixtures = true
config.infer_base_class_for_anonymous_controllers = true
config.filter_run_excluding broken: true
config.render_views = true
# Use color in STDOUT
+4
View File
@@ -0,0 +1,4 @@
def show_page
save_page Rails.root.join( 'public', 'capybara.html' )
%x(launchy http://localhost:3000/capybara.html)
end