从电子邮件中点击后的水豚电子邮件电子邮件

capybara-email email after click from email

正在使用:Rails4,RSpec3,水豚,水豚邮箱。

创建对象后,用户会收到 link 中的电子邮件。如果用户单击此 link,另一个用户会收到另一封电子邮件。

那么如何在同一测试中测试两封电子邮件?

我的样本:

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

下面的方法解决了,

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

也许有人有更好的解决方案,请分享。