More advance signup flow
This commit is contained in:
@@ -18,13 +18,7 @@ Feature: Manage settings
|
||||
When I visit the supplier settings path
|
||||
And I provide a new supplier email address
|
||||
And the supplier submits the supplier settings form
|
||||
#Then the supplier should see a settings saved message
|
||||
Then the supplier email should not have been changed
|
||||
And the supplier unconfirmed email should have been set to the new supplier email
|
||||
And an email should have been sent to the original supplier email with email confirmation instructions
|
||||
When the supplier clicks on the new email confirmation link
|
||||
Then the supplier should be redirected to the supplier settings path
|
||||
And the supplier email is the new email and the unconfirmed email is empty
|
||||
Then the supplier email is the new email
|
||||
|
||||
@javascript @broken
|
||||
Scenario: Setting the timezone
|
||||
|
||||
@@ -6,8 +6,22 @@ Feature: A supplier can sign up
|
||||
And fill in the supplier signup form with new credentials
|
||||
And click on the supplier signup submit button
|
||||
And I wait 1 second
|
||||
Then a new unconfirmed supplier with the new signup credentials should be created
|
||||
And a supplier signup confirmation mail should be sent containing a link to the token
|
||||
When I visit the supplier signup confirmation path with the correct token
|
||||
Then the new signup supplier should be confirmed
|
||||
And the supplier should be redirected to the supplier settings path
|
||||
Then a new supplier with the new signup data should be created
|
||||
And the supplier should be redirected to the supplier '/pages/introduction' path
|
||||
|
||||
@javascript
|
||||
Scenario: Existing non signed-in employee creates new supplier
|
||||
Given there is a confirmed employee
|
||||
When I visit the supplier signup path
|
||||
And fill in the supplier signup form with existing employee credentials
|
||||
And click on the supplier signup submit button
|
||||
And I wait 1 second
|
||||
Then a new supplier with the existing employee should be created
|
||||
And the supplier should be redirected to the supplier '/pages/introduction' path
|
||||
|
||||
|
||||
#Scenarios
|
||||
#- non existing non signed in employee
|
||||
#- existing non signed in employee
|
||||
#- existing signed in emloyee
|
||||
#- Supplier name exist for existing employee
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
|
||||
step "there is a confirmed employee" do
|
||||
@employee_password = 'admin123'
|
||||
@employee = nil
|
||||
expect {
|
||||
@employee = create :employee, :confirmed, password: @employee_password
|
||||
}.to change{ Employee.count }.by 1
|
||||
end
|
||||
|
||||
@@ -36,3 +36,9 @@ end
|
||||
step "the supplier employee visits the :path_spec path" do |path_spec|
|
||||
visit "/supplier#/#{path_spec}"
|
||||
end
|
||||
|
||||
step "the supplier should be redirected to the supplier :path path" do |path|
|
||||
# route_should_be 'supplier#edit'
|
||||
ember_route_should_be path
|
||||
end
|
||||
|
||||
|
||||
@@ -35,15 +35,9 @@ step "the supplier clicks on the new email confirmation link" do
|
||||
visit @confirmation_link
|
||||
end
|
||||
|
||||
step "the supplier should be redirected to the supplier settings path" do
|
||||
# route_should_be 'supplier#edit'
|
||||
ember_route_should_be '/settings'
|
||||
end
|
||||
|
||||
step "the supplier email is the new email and the unconfirmed email is empty" do
|
||||
step "the supplier email is the new email" do
|
||||
@supplier.reload
|
||||
@supplier.email.should == 'new-supplier-mail@mozo.bar'
|
||||
@supplier.unconfirmed_email.should be_blank
|
||||
end
|
||||
|
||||
step "the supplier selects :time_zone as Time Zone" do |visual_time_zone|
|
||||
@@ -51,6 +45,7 @@ step "the supplier selects :time_zone as Time Zone" do |visual_time_zone|
|
||||
end
|
||||
|
||||
step "the supplier timezone should be :time_zone" do |time_zone|
|
||||
sleep 1
|
||||
@supplier.reload
|
||||
@supplier.time_zone.should == time_zone
|
||||
end
|
||||
|
||||
@@ -1,29 +1,50 @@
|
||||
|
||||
step "I visit the supplier signup path" do
|
||||
visit new_supplier_registration_path
|
||||
visit new_suppliers_path
|
||||
end
|
||||
|
||||
step "fill in the supplier signup form with new credentials" do
|
||||
js_set_field '#supplier_name', 'Signup Supplier'
|
||||
js_set_field '#supplier_email', 'signup_supplier@example.com'
|
||||
js_set_field '#supplier_password', 'SignupSupplier'
|
||||
js_set_field '#supplier_password_confirmation', 'SignupSupplier'
|
||||
js_set_field '#new_supplier_supplier_name', 'Signup Supplier'
|
||||
js_set_field '#new_supplier_email', 'signup_supplier@example.com'
|
||||
js_set_field '#new_supplier_password', 'SignupSupplier'
|
||||
js_set_field '#new_supplier_password_confirmation', 'SignupSupplier'
|
||||
end
|
||||
step "fill in the supplier signup form with existing employee credentials" do
|
||||
js_set_field '#new_supplier_supplier_name', 'Signup Supplier'
|
||||
js_set_field '#new_supplier_email', @employee.email
|
||||
js_set_field '#new_supplier_password', @employee_password
|
||||
js_set_field '#new_supplier_password_confirmation', @employee_password
|
||||
end
|
||||
|
||||
step "click on the supplier signup submit button" do
|
||||
find('[name="commit"]').click
|
||||
end
|
||||
|
||||
step "a new unconfirmed supplier with the new signup credentials should be created" do
|
||||
@signup_supplier = Supplier.find_by_email('signup_supplier@example.com')
|
||||
step "a new supplier with the new signup data should be created" do
|
||||
@signup_supplier = Supplier.find_by_name('Signup Supplier')
|
||||
@signup_supplier.should be_present
|
||||
@signup_supplier.should_not be_confirmed
|
||||
|
||||
@signup_employee = Employee.find_by_email('signup_supplier@example.com')
|
||||
@signup_employee.should be_present
|
||||
|
||||
@employee_settings = @signup_supplier.settings_for(@signup_employee)
|
||||
@employee_settings.should be_present
|
||||
@employee_settings.manager?.should be true
|
||||
end
|
||||
|
||||
step "a new supplier with the existing employee should be created" do
|
||||
@signup_supplier = Supplier.find_by_name('Signup Supplier')
|
||||
@signup_supplier.should be_present
|
||||
Employee.count.should eq 1 # No new employee, but existing
|
||||
@employee_settings = @signup_supplier.settings_for(@employee)
|
||||
@employee_settings.should be_present
|
||||
@employee_settings.manager?.should be true
|
||||
end
|
||||
|
||||
step "a supplier signup confirmation mail should be sent containing a link to the token" do
|
||||
mail = ActionMailer::Base.deliveries.last
|
||||
mail.should be_present
|
||||
mail.body.should match /confirmation_token=#{@signup_supplier.confirmation_token}/
|
||||
mail.body.should match /confirmation_token=\w+/
|
||||
end
|
||||
|
||||
step "I visit the supplier signup confirmation path with the correct token" do
|
||||
|
||||
@@ -5,7 +5,7 @@ FactoryGirl.define do
|
||||
password 'secret'
|
||||
|
||||
trait :confirmed do
|
||||
confirmed_at { Time.now }
|
||||
#confirmed_at { Time.now }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user