rails/actionmailer/CHANGELOG.md
bogdanvlviv 4382fcbc22
Allow call assert_enqueued_with and assert_enqueued_email_with with no block
Example of `assert_enqueued_with` with no block
```ruby
def test_assert_enqueued_with
  MyJob.perform_later(1,2,3)
  assert_enqueued_with(job: MyJob, args: [1,2,3], queue: 'low')

  MyJob.set(wait_until: Date.tomorrow.noon).perform_later
  assert_enqueued_with(job: MyJob, at: Date.tomorrow.noon)
end
```

Example of `assert_enqueued_email_with` with no block:
```ruby
def test_email
  ContactMailer.welcome.deliver_later
  assert_enqueued_email_with ContactMailer, :welcome
end

def test_email_with_arguments
  ContactMailer.welcome("Hello", "Goodbye").deliver_later
  assert_enqueued_email_with ContactMailer, :welcome, args: ["Hello", "Goodbye"]
end
```

Related to #33243
2018-06-29 15:37:02 +03:00

1.2 KiB

  • Allow call assert_enqueued_email_with with no block.

    Example:

    def test_email
      ContactMailer.welcome.deliver_later
      assert_enqueued_email_with ContactMailer, :welcome
    end
    
    def test_email_with_arguments
      ContactMailer.welcome("Hello", "Goodbye").deliver_later
      assert_enqueued_email_with ContactMailer, :welcome, args: ["Hello", "Goodbye"]
    end
    

    bogdanvlviv

  • Ensure mail gem is eager autoloaded when eager load is true to prevent thread deadlocks.

    Samuel Cochran

  • Perform email jobs in assert_emails.

    Gannon McGibbon

  • Add Base.unregister_observer, Base.unregister_observers, Base.unregister_interceptor, Base.unregister_interceptors, Base.unregister_preview_interceptor and Base.unregister_preview_interceptors. This makes it possible to dynamically add and remove email observers and interceptors at runtime in the same way they're registered.

    Claudio Ortolina, Kota Miyake

  • Rails 6 requires Ruby 2.4.1 or newer.

    Jeremy Daer

Please check 5-2-stable for previous changes.