diff --git a/features/email/email.feature b/features/email/email.feature index a07af227..d5d96e0f 100644 --- a/features/email/email.feature +++ b/features/email/email.feature @@ -36,4 +36,25 @@ Feature: I can test emails are sent And the user's email is delivered Then 1 email should be delivered to the user And the email should contain "Dear Fred" - And the email should link to the user's page \ No newline at end of file + And the email should link to the user's page + + Scenario: Following the first link in an email + Given a user exists with name: "Fred", email: "fred@gmail.com" + And an email "cool" with body: "some text example page more text" is delivered to fred@gmail.com + Then 1 email should be delivered to the user + And I click the first link in the email + Then I should be at the user's page + + Scenario: Following a link in an email by url + Given a user exists with name: "Fred", email: "fred@gmail.com" + And an email "cool" with body: "some text example page more text" is delivered to fred@gmail.com + Then 1 email should be delivered to the user + And I follow "example.com/" in the email + Then I should be at the user's page + + Scenario: Following a link in an email by the text + Given a user exists with name: "Fred", email: "fred@gmail.com" + And an email "cool" with body: "some text example page more text" is delivered to fred@gmail.com + Then 1 email should be delivered to the user + And I follow "example page" in the email + Then I should be at the user's page diff --git a/rails_generators/pickle/templates/email_steps.rb b/rails_generators/pickle/templates/email_steps.rb index 172d4a3d..af2ef3cd 100755 --- a/rails_generators/pickle/templates/email_steps.rb +++ b/rails_generators/pickle/templates/email_steps.rb @@ -22,7 +22,7 @@ visit_in_email(email(email_ref), link) end -When(/^(?:I|they) click the first link in #{capture_email}$/) do +When(/^(?:I|they) click the first link in #{capture_email}$/) do |email_ref| click_first_link_in_email(email(email_ref)) end