diff options
Diffstat (limited to 'actionmailer')
-rw-r--r-- | actionmailer/CHANGELOG.md | 17 | ||||
-rw-r--r-- | actionmailer/test/test_helper_test.rb | 31 |
2 files changed, 46 insertions, 2 deletions
diff --git a/actionmailer/CHANGELOG.md b/actionmailer/CHANGELOG.md index 88e8a36eaa..1468a89e96 100644 --- a/actionmailer/CHANGELOG.md +++ b/actionmailer/CHANGELOG.md @@ -1,3 +1,20 @@ +* 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* diff --git a/actionmailer/test/test_helper_test.rb b/actionmailer/test/test_helper_test.rb index 8fdc687a8b..dcea23aabb 100644 --- a/actionmailer/test/test_helper_test.rb +++ b/actionmailer/test/test_helper_test.rb @@ -252,7 +252,16 @@ class TestHelperMailerTest < ActionMailer::TestCase end end - def test_assert_enqueued_email_with_args + def test_assert_enqueued_email_with_with_no_block + assert_nothing_raised do + silence_stream($stdout) do + TestHelperMailer.test.deliver_later + assert_enqueued_email_with TestHelperMailer, :test + end + end + end + + def test_assert_enqueued_email_with_with_args assert_nothing_raised do assert_enqueued_email_with TestHelperMailer, :test_args, args: ["some_email", "some_name"] do silence_stream($stdout) do @@ -262,7 +271,16 @@ class TestHelperMailerTest < ActionMailer::TestCase end end - def test_assert_enqueued_email_with_parameterized_args + def test_assert_enqueued_email_with_with_no_block_with_args + assert_nothing_raised do + silence_stream($stdout) do + TestHelperMailer.test_args("some_email", "some_name").deliver_later + assert_enqueued_email_with TestHelperMailer, :test_args, args: ["some_email", "some_name"] + end + end + end + + def test_assert_enqueued_email_with_with_parameterized_args assert_nothing_raised do assert_enqueued_email_with TestHelperMailer, :test_parameter_args, args: { all: "good" } do silence_stream($stdout) do @@ -271,6 +289,15 @@ class TestHelperMailerTest < ActionMailer::TestCase end end end + + def test_assert_enqueued_email_with_with_no_block_wiht_parameterized_args + assert_nothing_raised do + silence_stream($stdout) do + TestHelperMailer.with(all: "good").test_parameter_args.deliver_later + assert_enqueued_email_with TestHelperMailer, :test_parameter_args, args: { all: "good" } + end + end + end end class AnotherTestHelperMailerTest < ActionMailer::TestCase |