Working and specced supplier signup
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
Feature: Manage settings
|
||||
Scenario: Changing the supplier email
|
||||
@@ -0,0 +1,11 @@
|
||||
Feature: A supplier can sign up
|
||||
Scenario: It works
|
||||
When I visit the supplier signup path
|
||||
And fill in the supplier signup form with new credentials
|
||||
And click on the supplier signup submit button
|
||||
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 I should be redirected to the supplier settings page
|
||||
|
||||
@@ -9,3 +9,8 @@ end
|
||||
step "I visit the supplier section path" do
|
||||
visit "/supplier/sections/#{@section.id}"
|
||||
end
|
||||
|
||||
|
||||
step "I should be redirected to the supplier settings page" do
|
||||
page.current_path.should == supplier_settings_path
|
||||
end
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
|
||||
step "I visit the supplier signup path" do
|
||||
visit new_supplier_registration_path
|
||||
end
|
||||
|
||||
step "fill in the supplier signup form with new credentials" do
|
||||
find('#supplier_name').set 'Signup Supplier'
|
||||
find('#supplier_email').set 'signup_supplier@example.com'
|
||||
find('#supplier_password').set 'SignupSupplier'
|
||||
find('#supplier_password_confirmation').set 'SignupSupplier'
|
||||
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')
|
||||
@signup_supplier.should be_present
|
||||
@signup_supplier.should_not be_confirmed
|
||||
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}/
|
||||
end
|
||||
|
||||
step "I visit the supplier signup confirmation path with the correct token" do
|
||||
visit supplier_confirmation_path(confirmation_token: @signup_supplier.confirmation_token)
|
||||
end
|
||||
|
||||
step "the new signup supplier should be confirmed" do
|
||||
@signup_supplier.reload
|
||||
@signup_supplier.should be_confirmed
|
||||
end
|
||||
+1
-1
@@ -64,7 +64,7 @@ RSpec.configure do |config|
|
||||
end
|
||||
|
||||
config.before :each, type: :feature do
|
||||
Supplier.any_instance.stub send_confirmation_instructions: true
|
||||
#Supplier.any_instance.stub send_confirmation_instructions: true
|
||||
end
|
||||
|
||||
# If true, the base class of anonymous controllers will be inferred
|
||||
|
||||
Reference in New Issue
Block a user