Supplier mail changing and polishing
This commit is contained in:
@@ -12,5 +12,10 @@ end
|
||||
|
||||
|
||||
step "I should be redirected to the supplier settings page" do
|
||||
page.current_path.should == supplier_settings_path
|
||||
#page.current_path.should == supplier_settings_path
|
||||
route_should_be 'supplier#edit'
|
||||
end
|
||||
|
||||
step "I visit the supplier settings path" do
|
||||
visit supplier_settings_path
|
||||
end
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
step "I provide a new supplier email address" do
|
||||
find('#supplier_email').set 'new-supplier-mail@qwaiter.com'
|
||||
end
|
||||
|
||||
step "the supplier submits the supplier settings form" do
|
||||
find('.submit-supplier-settings').click
|
||||
end
|
||||
|
||||
step "the supplier email should not have been changed" do
|
||||
@supplier.reload
|
||||
@supplier.email.should == 'supplier@qwaiter.com'
|
||||
end
|
||||
|
||||
step "the supplier unconfirmed email should have been set to the new supplier email" do
|
||||
@supplier.reload
|
||||
@supplier.unconfirmed_email.should == 'new-supplier-mail@qwaiter.com'
|
||||
end
|
||||
|
||||
step "an email should have been sent to the original supplier email with email confirmation instructions" do
|
||||
mail = ActionMailer::Base.deliveries.last
|
||||
mail.to.should == ['supplier@qwaiter.com']
|
||||
mail.body.should include I18n.t('devise.mailer.confirmation_instructions.supplier.salutation', email: @supplier.email)
|
||||
mail.body.should_not include 'translation' # indicating a translation issue
|
||||
confirmation_link_match = mail.body.match(/http:\/\/www.qwaiter.com(\/suppliers\/confirmation[^"]+)"/)
|
||||
confirmation_link_match.should be_present
|
||||
@confirmation_link = confirmation_link_match[1]
|
||||
end
|
||||
|
||||
step "the supplier clicks on the new email confirmation link" do
|
||||
visit @confirmation_link
|
||||
end
|
||||
|
||||
step "the supplier gets redirected to the supplier settings path" do
|
||||
route_should_be 'supplier#edit'
|
||||
end
|
||||
|
||||
step "the supplier email is the new email and the unconfirmed email is empty" do
|
||||
@supplier.reload
|
||||
@supplier.email.should == 'new-supplier-mail@qwaiter.com'
|
||||
@supplier.unconfirmed_email.should be_blank
|
||||
end
|
||||
Reference in New Issue
Block a user