Fix employee adding

This commit is contained in:
2015-02-27 11:09:16 +01:00
parent 6e805fed3e
commit bfc0f336d1
13 changed files with 137 additions and 21 deletions
@@ -8,7 +8,13 @@ step "the supplier employee clicks on the other employee table edit button" do
all('tr').last.find('.table-edit').click
end
step "the supplier emloyee sets the :attribute to :value" do |attribute, value|
step "the supplier employee clicks on the existing employee table destroy button" do
find 'table.table'
sleep 0.2
all('tr').last.find('.table-destroy').click
end
step "the supplier emloyee sets the :attribute to :value in the employee popup" do |attribute, value|
js_set_field ".form-row.#{attribute} input", value
end
@@ -21,3 +27,24 @@ step "the other employee should no longer be active for the current supplier" do
@supplier.reload
@supplier.settings_for(@other_employee).active?.should be false
end
step "the new employee should be added to the supplier" do
@new_employee = Employee.find_by_email('new-employee@example.com')
@new_employee.should be_present
@new_employee.name.should eq 'New employee'
@supplier.reload
settings = @supplier.settings_for @new_employee
settings.is_manager?.should be true
settings.is_active?.should be true
end
step "the new employee should be re-added to the supplier as non manager non active" do
# Non active for a non default setting change to be recorded
@existing_employee = Employee.find_by_email('existing-employee@example.com')
@existing_employee.should be_present
@existing_employee.name.should eq 'Existing employee readded'
@supplier.reload
settings = @supplier.settings_for @existing_employee
settings.is_manager?.should be false
settings.is_active?.should be false
end