Assume a user is updating his password, and click submit, the system will send an email which include a confirmation link to his mailbox. My question is: how can I get the email and click the confirmation link when I use rspec+capybara-webkit test my system,
Hope you want to test email of ActionMailer by opening it.
Please use capybara-email
gem
https://github.com/dockyard/capybara-email
you can do below stuff
Scenario: Email is sent to winning user
Given "me@example.com" is playing a game
When that user picks a winning piece
Then "me@example.com" receives an email with "You've Won!" as the subject
Then /^"([^"]*)" receives an email with "([^"]*)" as the subject$/ do |email_address, subject|
open_email(email_address)
expect(current_email.subject).to eq subject
end