capybara-email
capybara-email copied to clipboard
Any plans to make this gem work with parallel tests?
Rails 6 has parallel testing enabled by default, each test worker running under its own port.
This means, setting a server_port
doesn't work anymore.
Edit: Just realized this Gem is dead :-)
Since I found nothing yet to replace CapybaraEmail, I monkey patched the deliver_later
method from with test/application_system_test_case.rb
:
class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
…
# Monkey patch to always deliver mails immediately, needed for CapybaraEmail to work
class ActionMailer::MessageDelivery
def deliver_later
deliver_now
end
end
end
Works fine for me with Rails 6!
Just added this piece to actually deliver the email, and not just enqueue it.
around { |example| perform_enqueued_jobs(&example) }
I use it successfully in system tests with:
driven_by :selenium, using: :headless_chrome