capybara-email icon indicating copy to clipboard operation
capybara-email copied to clipboard

Any plans to make this gem work with parallel tests?

Open cseelus opened this issue 5 years ago • 1 comments

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

cseelus avatar Mar 03 '19 21:03 cseelus

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

mtomov avatar Aug 28 '19 13:08 mtomov