I've written a test for a controller that sends email using ActionMailer. The problem is the test fails sporadically. It almost seems like ActionMailer::Base.deliveries isn't being updated by the time the assert checks, but I don't think ActionMailer sends emails asynchronously, at least nothing in the guide indicates that is the case.
I tried adding a sleep before the assert to see if it was a threading thing, but I still get the failure at about the same interval.
Here is my test code:
test "should remind players" do session.clear get :reminder assert_emails 2 assert_equal %w[email@example.com], ActionMailer::Base.deliveries.to assert_equal "Game Reminder", ActionMailer::Base.deliveries.subject assert_equal users(:two).email, ActionMailer::Base.deliveries.from end
Any known issues with intermittent ActionMailer or ActionMailer::TestCase failures?