Spec employees

This commit is contained in:
2015-02-24 13:43:44 +01:00
parent 755690131c
commit 16418dde30
18 changed files with 104 additions and 97 deletions
@@ -0,0 +1,13 @@
Feature: Manage employees
@javascript
Scenario: a just signed up manager can manage employees
Given there is a confirmed and open supplier
And there is an other employee
And I am signed in as supplier
When the supplier employee visits the 'employees' path
And the supplier employee clicks on the other employee table edit button
And the supplier emloyee sets the 'name' to 'Edited employee'
And the supplier emloyee clicks the active switch to deactivate the employee
And the supplier employee clicks the confirm modal button
Then the other employee should no longer be active for the current supplier
@@ -0,0 +1,23 @@
step "there is an other employee" do
@other_employee = create :employee, :confirmed, name: 'Other employee'
@supplier.add_employee @other_employee
end
step "the supplier employee clicks on the other employee table edit button" do
find 'table.table'
all('tr').last.find('.table-edit').click
end
step "the supplier emloyee sets the :attribute to :value" do |attribute, value|
js_set_field ".form-row.#{attribute} input", value
end
step "the supplier emloyee clicks the active switch to deactivate the employee" do
js_click '.form-row.active .switch'
end
step "the other employee should no longer be active for the current supplier" do
sleep 1
@supplier.reload
@supplier.settings_for(@other_employee).active?.should be false
end
@@ -0,0 +1,7 @@
step "the supplier employee clicks on :selector" do |selector|
js_click selector
end
step "the supplier employee clicks the confirm modal button" do
js_click '.modal-confirm'
end
@@ -32,3 +32,7 @@ end
step "the supplier should be redirected to the root path" do
ember_route_should_be '/'
end
step "the supplier employee visits the :path_spec path" do |path_spec|
visit "/supplier#/#{path_spec}"
end
@@ -14,15 +14,6 @@ describe Suppliers::ProductsController, type: :controller do
setup_supplier_for_controller
end
describe "GET #index" do
it "does not include products from another supplier" do
product1 = create :product, supplier: @supplier
product2 = create :product
get :index
assigns(:products).should eq([product1])
end
end
describe "GET #show" do
it "assigns the requested product to @product" do
product = create :product, supplier: @supplier
+1 -1
View File
@@ -14,7 +14,7 @@ describe Page do
it 'returns a NullPage when no page found' do
page = Page.suppliers_page('non-existent', locale: 'nl')
page.should be_a Page::NullPage
page.should_not be_present
page.title.should == 'Non existent'
page.locale.should == 'nl'
end