Files
mozo-backend/spec/acceptance_steps/suppliers/signup_steps.rb
T
2015-01-21 19:18:12 +01:00

37 lines
1.3 KiB
Ruby

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
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'
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