Oleh  Sobchuk
Oleh Sobchuk

Reputation: 3722

capybara-email email after click from email

In use: Rails 4, RSpec 3, capybara, capybara-email.

After create object user receive email in which present link. If user click this link, another user receive another email.

So how I can test two emails in same test?

My sample:

scenario 'Sample test', js: true do
  my_page.create_object(name: 'example')
  open_email(user.email)
  expect(current_email).to have_content('example')
  current_email.click_link('ACCEPT')
  # there will be request to server and
  # if all is ok, sending next email to same user
  # how I can open next email?
end

Upvotes: 1

Views: 741

Answers (1)

Oleh  Sobchuk
Oleh Sobchuk

Reputation: 3722

Solved in next way,

scenario 'Sample test', js: true do
  my_page.create_object(name: 'example')
  open_email(user.email)
  expect(current_email).to have_content('example')
  clear_emails
  visit path_from_link_path
  open_email(user.email)
  expect(current_email).to have_content('other text')
  clear_emails
end

Maybe someone have better solution, please share it.

Upvotes: 0

Related Questions