Email 水豚从电子邮件中单击后发送电子邮件
正在使用:Rails 4、RSpec 3、水豚、水豚电子邮件 创建对象后,用户将收到电子邮件,其中显示链接。如果用户单击此链接,其他用户将收到另一封电子邮件 那么我如何在同一测试中测试两封电子邮件呢 我的样本:Email 水豚从电子邮件中单击后发送电子邮件,email,ruby-on-rails-4,rspec,capybara,rspec3,Email,Ruby On Rails 4,Rspec,Capybara,Rspec3,正在使用:Rails 4、RSpec 3、水豚、水豚电子邮件 创建对象后,用户将收到电子邮件,其中显示链接。如果用户单击此链接,其他用户将收到另一封电子邮件 那么我如何在同一测试中测试两封电子邮件呢 我的样本: scenario 'Sample test', js: true do my_page.create_object(name: 'example') open_email(user.email) expect(current_email).to have_content('e
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
也许有人有更好的解决方案,请分享。用下一种方法解决
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
也许有人有更好的解决方案,请分享