Many supplier features and style upgrades and fixes

This commit is contained in:
2015-10-06 16:08:00 +02:00
parent b7a5b3b750
commit 2df5b290ef
50 changed files with 225 additions and 474 deletions
+3 -3
View File
@@ -8,7 +8,7 @@ Feature: Manage employees
And I click on selector '.new-employee-button'
And the supplier emloyee sets the 'name' to 'New employee' in the employee popup
And the supplier emloyee sets the 'email' to 'new-employee@example.com' in the employee popup
And I click on selector '.form-row.manager .switch'
And I click on selector '.form-row.manager label'
And I click on selector '.modal-confirm'
And I wait 1 second
Then the new employee should be added to the supplier
@@ -23,14 +23,14 @@ Feature: Manage employees
And I click on selector '.new-employee-button'
And the supplier emloyee sets the 'name' to 'Existing employee' in the employee popup
And the supplier emloyee sets the 'email' to 'existing-employee@example.com' in the employee popup
And I click on selector '.form-row.manager .switch'
And I click on selector '.form-row.manager label'
And I click on selector '.modal-confirm'
And the supplier employee clicks on the existing employee table destroy button
And I click on selector '.modal-confirm'
And I click on selector '.new-employee-button'
And the supplier emloyee sets the 'name' to 'Existing employee readded' in the employee popup
And the supplier emloyee sets the 'email' to 'existing-employee@example.com' in the employee popup
And I click on selector '.form-row.active .switch'
And I click on selector '.form-row.active label'
And I click on selector '.modal-confirm'
And I wait 1 second
Then the new employee should be re-added to the supplier as non manager non active
@@ -19,3 +19,6 @@ Feature: Adding product category
#And the supplier clicks on the tuesday and wednesday buttons selecting wednesday as active day
#And the supplier submits the product category form
#Then the the product category is active on wednesday and only linked to the last product
#@javascript
#Scenario: Setting a day for which the product category is active from false to true
@@ -52,7 +52,7 @@ end
step "the supplier dashboard list should display the updated price" do
sleep 0.5
el = find(".list-row-#{@list.id} .total_list_amount")
el = find(".list-row-#{@list.id} .currency")
# original order is 3 * 2.11 = 6.33
# new order price = 5 * 2.22 = 11.10
# therefore the updated price should be 17.43
@@ -61,21 +61,21 @@ end
step "the new order should be present in the supplier dashboard" do
el = find(".order-row-#{@new_order.id}")
el.find('.table_number').text.should == @table.number.to_s
el.find('.section_title').text.should == @section.title
el.find('.table-number').text.should == "# #{@table.number}"
el.find('.link-to-section').text.should == @section.title
end
step "the new order on a table in another section should be present in the supplier dashboard" do
el = find(".order-row-#{@new_order.id}")
el.find('.table_number').text.should == @other_table.number.to_s
el.find('.section_title').text.should == @other_section.title
el.find('.table-number').text.should == "# #{@other_table.number}"
el.find('.link-to-section').text.should == @other_section.title
end
step "the new list should appear in the supplier dashboard" do
el = find(".list-row-#{@new_list.id}")
el.find('.total_list_amount').text.should =~ /6.66/
el.find('.section_title').text.should == @other_section.title
el.find('.table_number').text.should == @other_table.number.to_s
el.find('.currency').text.should =~ /6.66/
el.find('.link-to-section').text.should == @other_section.title
el.find('.table-number').text.should == "# #{@other_table.number}"
end
step "I click on the close list button in the supplier dashboard" do
@@ -133,13 +133,13 @@ step "the active list changes to another table in another section" do
end
step "the supplier main board table number should be updated to the new table number" do
expect( find(".list-row-#{@list.id} .table_number").text ).to eq "65"
expect( find(".order-row-#{@list.orders.first.id} .table_number").text ).to eq "65"
expect( find(".list-row-#{@list.id} .table-number").text ).to eq "# 65"
expect( find(".order-row-#{@list.orders.first.id} .table-number").text ).to eq "65"
end
step "the supplier main board section name should be updated to the new section" do
expect( find(".list-row-#{@list.id} .section_title").text ).to eq "New Section"
expect( find(".order-row-#{@list.orders.first.id} .section_title").text ).to eq "New Section"
expect( find(".list-row-#{@list.id} .link-to-section").text ).to eq "New Section"
expect( find(".order-row-#{@list.orders.first.id} .link-to-section").text ).to eq "New Section"
end
# Marking order as wrong
@@ -152,7 +152,7 @@ step "the supplier main board order should not be visible anymore" do
end
step "the supplier main board list total should be updated" do
find(".list-row-#{@list.id} .total_list_amount").text.should == "€ 0.00"
find(".list-row-#{@list.id} .currency").text.should == "€ 0.00"
end
step "the supplier placed orders counter should be reduced" do
@@ -23,7 +23,7 @@ step "the supplier emloyee sets the :attribute to :value in the employee popup"
end
step "the supplier emloyee clicks the active switch to deactivate the employee" do
js_click '.form-row.active .switch'
js_click '.form-row.active label'
end
step "the other employee should no longer be active for the current supplier" do
@@ -7,7 +7,12 @@ step "the supplier fills in the new product category form selecting not availabl
# default all days on, so click on tuesday deactivates it
within '.modal' do
js_set_field '.form-row.name input', 'New product category'
find('.form-row.tuesday .switch').click
find('.form-row.tuesday label').click
js_click '.toggle-full-day-button'
js_set_field '.select-start_from .hour-of-day select', '08'
js_set_field '.select-start_from .minute-of-hour select', '20'
js_set_field '.select-end_on .hour-of-day select', '12'
js_set_field '.select-end_on .minute-of-hour select', '30'
end
end
@@ -19,7 +24,9 @@ step "then new product category with proper properties should have been created"
sleep 1
@product_category = ProductCategory.find_by_name 'New product category'
#@product_category.week_days.should == [0, 0, 1, 0, 0, 0, 0]
@product_category.full_day.should be true
@product_category.full_day.should be false
@product_category.start_from.should be 500 # 8:20
@product_category.end_on.should be 750 # 12:30
expect( @product_category.active_on_monday ).to be true
expect( @product_category.active_on_tuesday ).to be false
expect( @product_category.active_on_wednesday ).to be true
+1 -1
View File
@@ -10,7 +10,7 @@ describe User do
end
it 'falls back to unkown if not present' do
user.supplier_name.should == I18n.t('supplier.unknown_user_name')
user.supplier_name.should == I18n.t('supplier.user.unkown_name')
end
end
+2 -2
View File
@@ -1,10 +1,10 @@
require "spec_helper"
describe "routing", type: :routing do
it('roots to pages#home'){get('/').should route_to('pages#home', locale: 'en')}
it('roots to pages#home'){get('/').should route_to('pages#home', locale: 'nl')}
it('roots to pages#home for en locale'){get('/en').should route_to('pages#home', locale: 'en')}
it('roots to pages#home for nl locale'){get('/nl').should route_to('pages#home', locale: 'nl')}
it('handles about page as root'){ get('/about').should route_to('pages#show', name: 'about', locale: 'en')}
it('handles about page as root'){ get('/about').should route_to('pages#show', name: 'about', locale: 'nl')}
it('handles about page in nl'){ get('/nl/about').should route_to('pages#show', name: 'about', locale: 'nl')}
it('handles about page in en'){ get('/en/about').should route_to('pages#show', name: 'about', locale: 'en')}
end
+1 -1
View File
@@ -23,7 +23,7 @@ module Features
def user_visit(path)
#visit File.join("http://localhost:3/")
visit File.join(user_root_path, path)
visit File.join("/user/index.html#/", path)
end
def login_employee_as(email)