In RSpec I can easily follow the link corresponding to certain text using
click_link "change your password"
RSpec will then find the appropriate link and follow the associated HREF.
I'm trying to execute the same behaviour in an email using email_spec
. However I can't seem to find an equivalent helper that will click a link corresponding to particular link text in the email_spec helpers.
This seems like a pretty obvious use-case so before I write something to do it for me I wanted to check whether one already exists.
The scenario is that I want to follow whatever link in the email corresponds to "Change my password".
I expect you have the email_spec properly installed and the helper modules included in your spec or your spec_helper.rb file. If you did this, the proper methods would be available in your test. You then need to open_email and then call visit_in_email. Example:
open_email('[email protected]')
visit_in_email('Confirm my account')
expect(page).to have_content('Your email address has been successfully confirmed.')
The address used in the open_email call is the "to" field.
Hope this helps.