Commit Graph

636 Commits

Author SHA1 Message Date
Fumiaki MATSUSHIMA
61c4be4777 Output junit format test report 2019-04-04 14:34:46 +09:00
John Hawthorn
4e6c8045c3 Add test and change how format set in ActionMailer
Previously this used self.formats= to set the format which render would
use to find templates. This worked, but was untested, and looked a
little confusing because it was doing the mutation within a loop.

This commit replaces the assignment with passing formats: [format] into
the render call, which makes it more obvious that that's the purpose of
the format. It also adds a test to verify the formats being used.
2019-03-01 14:07:59 -08:00
Aaron Patterson
ff6b713f5e
Merge pull request #35293 from rails/remove-rendered-format-from-cache
Pass the template format to the digestor
2019-02-19 13:45:30 -08:00
Yoshiyuki Hirano
ed3f315907 Auto correct rubocop offenses
Offenses:

railties/lib/rails/autoloaders.rb:1:1: C: [Corrected] Style/FrozenStringLiteralComment: Missing magic comment # frozen_string_literal: true.
module Rails
^
actionmailer/test/base_test.rb:917:1: C: [Corrected] Layout/EmptyLinesAroundBlockBody: Extra empty line detected at block body beginning.
actionmailer/test/base_test.rb:917:1: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
actionmailer/test/base_test.rb:917:5: C: [Corrected] Style/RedundantBegin: Redundant begin block detected.
    begin
    ^^^^^
actionmailer/test/base_test.rb:918:3: C: [Corrected] Layout/IndentationWidth: Use 2 (not 4) spaces for indentation.
      events = []
  ^^^^
actionmailer/test/base_test.rb:930:1: C: [Corrected] Layout/EmptyLinesAroundBlockBody: Extra empty line detected at block body end.
actionmailer/test/base_test.rb:930:1: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
2019-02-17 17:12:22 +09:00
Aaron Patterson
a3a98606f3
pass format to the digestor 2019-02-16 10:57:51 -08:00
Jaap van der Plas
2488901da8 Don’t log recipients when sending mail
Since production applications typically run with log level info and
email adresses should be considered as sensitive data we want to prevent 
them from ending up in the logs. In development mode (with log level
debug) they are still logged as part of the Mail::Message object.
2019-02-13 09:55:38 -05:00
Matthew Somerville
c95e98090b Correctly wrap inline attachments.
This switches the behaviour from:

multipart/related
  multipart/alternative
    text/plain
    text/html
  attachment (disposition: inline, image1)
  attachment (disposition: attachment, file1)
  attachment (disposition: attachment, file2)

to:

multipart/mixed
  multipart/related
    multipart/alternative
      text/plain
      text/html
    attachment (disposition: inline, image1)
  attachment (disposition: attachment, file1)
  attachment (disposition: attachment, file2)

Fixes #2686.

Thanks to clemens and eGust for reviewing.
2019-01-22 09:50:10 +00:00
Gannon McGibbon
5d6578d15b Fix legacy fallback for parameterized mailers 2019-01-07 17:38:28 -05:00
bogdanvlviv
2e29488a89
Remove mention about receive.action_mailer from the AS instrumentation guide
Since e3f832a7433a291a51c5df397dc3dd654c1858cb `ActionMailer::Base.receive` is
deprecated.
2018-12-28 11:23:27 +02:00
George Claghorn
e3f832a743 Deprecate ActionMailer::Base.receive in favor of Action Mailbox 2018-12-27 21:17:58 -05:00
Ryuta Kamizono
892e38c78e Enable Style/RedundantBegin cop to avoid newly adding redundant begin block
Currently we sometimes find a redundant begin block in code review
(e.g. https://github.com/rails/rails/pull/33604#discussion_r209784205).

I'd like to enable `Style/RedundantBegin` cop to avoid that, since
rescue/else/ensure are allowed inside do/end blocks in Ruby 2.5
(https://bugs.ruby-lang.org/issues/12906), so we'd probably meets with
that situation than before.
2018-12-21 06:12:42 +09:00
pavel
bf01cc6744 fix tests for mail 2.8 2018-12-19 18:12:58 -08:00
Gannon McGibbon
f5050d998d Add MailDeliveryJob for unified mail delivery
Add `MailDeliveryJob` for delivering both regular and parameterized mail.
Deprecate using `DeliveryJob` and `Parameterized::DeliveryJob`.
2018-12-04 11:00:34 -05:00
Gannon McGibbon
ebf484a640 Add yield to with_delivery_job test helper
Adds yield to parameterized mail test helper so assertions
passed into with_delivery_job are actually ran.
2018-11-30 17:38:26 -05:00
Gannon McGibbon
60339da5bc Deliver parameterized mail with DeliveryJob
Deliver parameterized mail with `ActionMailer::DeliveryJob`
and remove `ActionMailer::Parameterized::DeliveryJob`.
2018-11-22 18:37:53 -05:00
Edouard CHIN
e139a3ce13 Fix ActionMailer assertion not working for mail defining delivery_job:
- If a Mail defines a custom delivery_job, all ActionMailer assertion
  helper (assert_emails, assert_enqueued_emails ...) wouldn't work.

  ```ruby
    MyMailer < ApplicationMailer
      self.delivery_job = MyJob
    end

    # This assertion will fail
    assert_emails(1) do
      MyMailer.my_mail.deliver_later
    end

  This PR leverage the new ActiveJob feature that accepts Procs for the
  `only` keyword and check if the delivery job is one of ActionMailer
   registered ones.
2018-11-21 23:17:04 +01:00
Rafael Mendonça França
72062c8c9d Merge pull request #22534 from evopark/master
ActionMailer: support overriding template name in multipart
2018-11-19 19:23:44 -05:00
yuuji.yaginuma
d2d6f6b7db Fix tests on Mail 2.7.1
Up to `2.7.0`, encoding was chosen using `Mail::Encodings::TransferEncoding.negotiate`,
and base64 encoding was used.
In `2.7.1`, when `transfer_encoding` is not specified, the encoding
of the message is respected.
Related to: dead487e02

However, what chosen for transfer encoding is not essential in these tests.
To test more accurately, confirm that the decoded body instead.
2018-10-14 14:44:47 +09:00
Luke Pearce
c90c6c1344 Parameterized mailers can configure delivery job
Setting parameterized_delivery_job on a mailer class will cause Parameterized::MessageDelivery to use
the specified job instead of ActionMailer::Parameterized::DeliveryJob:

    class MyMailer < ApplicationMailer
      self.parameterized_delivery_job = MyCustomDeliveryJob
      ...
    end
2018-10-05 17:02:40 +01:00
Rafael Mendonça França
f679933daa
Change the empty block style to have space inside of the block 2018-09-25 13:19:35 -04:00
Aaron Patterson
d34bd0d2d5
Merge pull request #33974 from rails/remove-catch-all-from-am
This patch removes deprecated catch-all routes from AM
2018-09-25 09:27:56 -07:00
Aaron Patterson
fefcb36811
This patch removes deprecated catch-all routes from AM
It also removes a monkey patch from AM::Base
2018-09-24 16:12:44 -07:00
Kasper Timm Hansen
22dc2b3db8
Merge pull request #33949 from sjain1107/no-private-def
Remove private def
2018-09-23 19:39:15 +02:00
Sakshi Jain
0fe2bb816f Remove private def 2018-09-23 21:27:44 +05:30
yuuji.yaginuma
1b86d90136 Enable Performance/UnfreezeString cop
In Ruby 2.3 or later, `String#+@` is available and `+@` is faster than `dup`.

```ruby
# frozen_string_literal: true

require "bundler/inline"

gemfile(true) do
  source "https://rubygems.org"

  gem "benchmark-ips"
end

Benchmark.ips do |x|
  x.report('+@') { +"" }
  x.report('dup') { "".dup }
  x.compare!
end
```

```
$ ruby -v benchmark.rb
ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux]
Warming up --------------------------------------
                  +@   282.289k i/100ms
                 dup   187.638k i/100ms
Calculating -------------------------------------
                  +@      6.775M (± 3.6%) i/s -     33.875M in   5.006253s
                 dup      3.320M (± 2.2%) i/s -     16.700M in   5.032125s

Comparison:
                  +@:  6775299.3 i/s
                 dup:  3320400.7 i/s - 2.04x  slower

```
2018-09-23 08:56:55 +09:00
Yoshiyuki Kinjo
576209b45b Add perform_deliveries to a payload of deliver.action_mailer notification. 2018-09-09 20:17:36 +09:00
Yoshiyuki Kinjo
383b8bc8e2 Skip delivery notification when perform_deliveries is false. 2018-09-08 17:29:28 +09:00
Kazuhiro Sera
52919f3d13 Fix the obvious typos detected by github.com/client9/misspell 2018-08-08 21:55:46 +09:00
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
Kota Miyake
b74edd37c5 ActionMailer::Base can unregister observer(s) and interceptor(s). (#32207)
* ActionMailer::Base can unregister observer(s) and interceptor(s).

One or multiple mail observers can be unregistered using
`ActionMailer::Base.unregister_observers` or
`ActionMailer::Base.unregister_observer`.

One or multiple mail interceptors can be unregistered using
`ActionMailer::Base.unregister_interceptors` or
`ActionMailer::Base.unregister_interceptor`.

For preview interceptors, it's possible to use
`ActionMailer::Base.unregister_preview_interceptors` or
`ActionMailer::Base.unregister_preview_interceptor`.

* Ensure to be reset registered observer(s) and interceptor(s)

* Add explanation to CHANGELOG

* Add original author's name

[Kota Miyake + Rafael Mendonça França + Claudio Ortolina]
2018-05-30 17:36:24 -04:00
Daniel Colson
a1ac18671a Replace assert ! with assert_not
This autocorrects the violations after adding a custom cop in
3305c78dcd.
2018-04-19 08:11:33 -04:00
Gannon McGibbon
96218b4568 Perform email jobs in #assert_emails
Perform enqueued delivery jobs in #assert_emails and #assert_no_emails.
2018-03-12 15:35:18 -04:00
Daniel Colson
82c39e1a0b Use assert_empty and assert_not_empty 2018-01-25 23:32:59 -05:00
Daniel Colson
94333a4c31 Use assert_predicate and assert_not_predicate 2018-01-25 23:32:59 -05:00
Daniel Colson
0d50cae996 Use respond_to test helpers 2018-01-25 23:32:58 -05:00
Ryuta Kamizono
6003dafc1f Merge pull request #30391 from jbourassa/fix-actionmailer-lambda-default
Fix actionmailer lambda default
2018-01-24 06:01:25 +09:00
Ryuta Kamizono
2b35826389 Enable Layout/SpaceBeforeComma rubocop rule, and fixed more
Follow up of #31390.
2017-12-12 20:00:50 +09:00
Jeremy Daer
0931e17ebf
Fix tests on Mail 2.7
Reverts 4d96be1c27bd6faed957b197a461f18543acebf2
References #31026
2017-10-31 21:44:58 -07:00
Rafael França
a8ebd48559
Merge pull request #31004 from shuheiktgw/remove_unnecessary_returns
Remove redundant return statements
2017-10-31 01:47:35 -04:00
Shuhei Kitagawa
03dd47ff21 removed unnecessary semicolons 2017-10-28 17:39:58 +09:00
Shuhei Kitagawa
c40b4428e6 removed unnecessary returns 2017-10-28 17:20:38 +09:00
Mikkel Malmberg
db6847dcb6 Add assert_enqueued_email_with to ActionMailer::TestHelper 2017-09-27 23:22:49 +02:00
Jimmy Bourassa
fbb2fc8aa7 Fix AM::Base.default proc arity breaking change
PR #29270 changed the number of arguments that gets passed to Procs
defined in ActionMail::Base.default. With this changeset, Procs can
now have 1 or 0 arguments

Also adds test coverage for AM::Base.default Proc arity.
2017-08-29 09:42:28 -04:00
Cameron Cundiff
9a74c7b99b Do not generate default alt text in image tags
- Auto-generating content from the filename of an image is not suitable
  alternative text; alt text that isn't fully considered can be
  distracting and fatiguing for screen readers users (blind, low vision,
  dyslexic people).
- Setting a filename fallback short circuits screen reader default
  behavior and configuration for blank descriptions.
- Setting poor defaults also creates false negatives for accessibility
  linting and testing software, that makes it harder to improve
  application accessibility.

***

- After this change, if authors leave images without alt text, screen
  readers will fallback to default behavior for missing alt text.
- Also with this change, Automated linting and testing tools will
  correctly generate warnings.

[Fixes #30096]
2017-08-17 16:13:15 -04:00
yuuji.yaginuma
2f469dc308 Clear mail after test
If clear it before the test, the mail of the last executed test will not
be correctly cleared.

Therefore, executing the test with seed below will result in an error.

```
./bin/test -w --seed 55480
Run options: --seed 55480

# Running:

...........................................................................................................................................................F

Failure:
MailDeliveryTest#test_does_not_increment_the_deliveries_collection_on_error [/home/yaginuma/program/rails/master_y_yagi/rails/actionmailer/test/delivery_methods_test.rb:221]:
--- expected
+++ actual
@@ -1 +1 @@
-[]
+[#<Mail::Message:47011389364640, Multipart: false, Headers: <Date: Mon, 14 Aug 2017 07:48:40 +0900>, <From: test-sender@test.com>, <To: test-receiver@test.com>, <Message-ID: <5990d748ea5b2_29342ac1af8bcf40886f7@yaginuma.mail>>, <Subject: Test Subject>, <Mime-Version: 1.0>, <Content-Type: text/plain>, <Content-Transfer-Encoding: 7bit>>]

bin/test test/delivery_methods_test.rb:216
```
2017-08-14 07:49:13 +09:00
Rafael Mendonça França
feb1ddae02 Merge remote-tracking branch 'origin/master' into unlock-minitest 2017-08-01 17:34:14 -04:00
Kir Shatrov
82df8c2ca5 Use frozen string literal in actionmailer/ 2017-07-23 18:17:19 +03:00
Kasper Timm Hansen
aad42dce10 Merge branch 'master' into unlock-minitest 2017-07-15 21:17:27 +02:00
Matthew Draper
87b3e226d6 Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"
This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing
changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
2017-07-02 02:15:17 +09:30
Matthew Draper
3420a14590 Merge pull request #29540 from kirs/rubocop-frozen-string
Enforce frozen string in Rubocop
2017-07-02 01:11:50 +09:30
Kir Shatrov
cfade1ec7e Enforce frozen string in Rubocop 2017-07-01 02:11:03 +03:00
Pat Allan
dd491b24ff Make ActionMailer frozen string literal friendly. 2017-06-20 19:45:46 +10:00
Matthew Mongeau
d9bbde09fc Allow mailers to configure their delivery job
Setting delivery_job on a mailer class will cause MessageDelivery to use
the specified job instead of ActionMailer::DeliveryJob:

    class MyMailer < ApplicationMailer
      self.delivery_job = MyCustomDeliveryJob

      ...
    end
2017-06-15 16:41:23 +09:00
Kasper Timm Hansen
e1758b5e8c Merge branch 'master' into unlock-minitest 2017-05-29 20:37:35 +02:00
bogdanvlviv
40bdbce191
Define path with __dir__
".. with __dir__ we can restore order in the Universe." - by @fxn

Related to 5b8738c2df003a96f0e490c43559747618d10f5f
2017-05-23 00:53:51 +03:00
David Heinemeier Hansson
75fa8dd309 Use recyclable cache keys (#29092) 2017-05-18 18:12:32 +02:00
Ryuta Kamizono
b201474756 Should escape meta characters in regexp 2017-05-07 04:10:00 +09:00
Rafael Mendonça França
0d35a60ff7
Avoid stubing on this test
This will avoid to the test fail when running in isolation because the
message generated is nil.
2017-04-27 02:05:00 -07:00
Rafael França
f680664d4e Merge pull request #28244 from ixti/improve/action-mailer-preview-params
Pass request params to ActionMailer::Preview
2017-04-26 20:15:30 -07:00
yuuji.yaginuma
e4cf71bf7a Remove duplicated delivery_method definition
`ActionMailer::Base.delivery_method` is already defined in
https://github.com/rails/rails/blob/master/actionmailer/test/parameterized_test.rb#L13
2017-04-07 21:58:08 +09:00
Andrew White
c7135d2c8e Use better duration aliases in tests 2017-03-15 14:56:27 +00:00
Andrew White
ef28b68496 Don't cast to float unnecessarily
Adding durations to `Time` instances is perfectly okay.
2017-03-15 08:19:27 +00:00
Andrew White
75924c4517 Deprecate implicit coercion of ActiveSupport::Duration
Currently `ActiveSupport::Duration` implicitly converts to a seconds
value when used in a calculation except for the explicit examples of
addition and subtraction where the duration is the receiver, e.g:

    >> 2 * 1.day
    => 172800

This results in lots of confusion especially when using durations
with dates because adding/subtracting a value from a date treats
integers as a day and not a second, e.g:

    >> Date.today
    => Wed, 01 Mar 2017
    >> Date.today + 2 * 1.day
    => Mon, 10 Apr 2490

To fix this we're implementing `coerce` so that we can provide a
deprecation warning with the intent of removing the implicit coercion
in Rails 5.2, e.g:

    >> 2 * 1.day
    DEPRECATION WARNING: Implicit coercion of ActiveSupport::Duration
    to a Numeric is deprecated and will raise a TypeError in Rails 5.2.
    => 172800

In Rails 5.2 it will raise `TypeError`, e.g:

    >> 2 * 1.day
    TypeError: ActiveSupport::Duration can't be coerced into Integer

This is the same behavior as with other types in Ruby, e.g:

    >> 2 * "foo"
    TypeError: String can't be coerced into Integer
    >> "foo" * 2
    => "foofoo"

As part of this deprecation add `*` and `/` methods to `AS::Duration`
so that calculations that keep the duration as the receiver work
correctly whether the final receiver is a `Date` or `Time`, e.g:

    >> Date.today
    => Wed, 01 Mar 2017
    >> Date.today + 1.day * 2
    => Fri, 03 Mar 2017

Fixes #27457.
2017-03-02 08:00:22 +00:00
Alexey Zapparov
8e6c6d854c
Pass request params to ActionMailer::Preview 2017-03-01 20:54:14 +01:00
yuuji.yaginuma
53b98f1dda Add :args to process.action_mailer event 2017-02-04 11:43:24 +09:00
Rafael Mendonça França
0435d65000
Avoid should in test names 2017-01-30 13:28:31 -05:00
Rafael Mendonça França
735aa635c5
Implement respond_to_missing? in the Parameterized::Mailer class 2017-01-30 13:28:14 -05:00
David Heinemeier Hansson
d5651436d6 Make assert_enqueued_emails + assert_no_enqueued_emails consider parameterized delivery jobs
Needed for testing of parameterized mailers
2017-01-30 13:41:08 +01:00
yuuji.yaginuma
a28f8b5baf restore delivery_method after test
Currently use two variables to restore `delivery_method`, but the order
of restoring the values is incorrect and does not restore is correctly.
2017-01-29 00:52:44 +09:00
David Heinemeier Hansson
1cec84ad2d Offer the option to use parameterization for shared processing of headers and ivars (#27825)
Offer the option to use parameterization for shared processing of headers and ivars
2017-01-28 11:20:46 +01:00
Akira Matsuda
146e928800 Don't pollute Object with rubinius_skip and jruby_skip
we call them only in the tests
2017-01-17 18:51:50 +09:00
Akira Matsuda
b70fc698e1 Reduce string objects by using \ instead of + or << for concatenating strings
(I personally prefer writing one string in one line no matter how long it is, though)
2017-01-12 17:45:37 +09:00
Akira Matsuda
c82fa18514 Use Encoding::UTF_8 constant for default_{internal,external} in the tests 2017-01-11 17:48:00 +09:00
Rafael Mendonça França
e482dce0ed
Merge pull request #27227 from MQuy/allow-custom-content-type-in-mail-body
Allow to custom content type when setting mailer body
2017-01-06 06:03:41 -05:00
Rafael Mendonça França
7339547602
Remove unneeded Deprecation.silence 2017-01-03 20:54:34 -05:00
Akira Matsuda
8e1da1188f Privatize unneededly protected methods in Action Mailer tests 2016-12-24 00:15:11 +09:00
MQuy
36efba0520 Fix wrong typo in test 2016-12-05 21:47:49 +08:00
MQuy
c4639b7737 allow context type when set body mail 2016-11-30 22:18:14 +08:00
Rafael Mendonça França
fe1f4b2ad5
Add more rubocop rules about whitespaces 2016-10-29 01:17:49 -02:00
Rafael Mendonça França
79a5ea9ead
Remove deprecated support to :text in render 2016-10-10 00:02:52 -03:00
Rafael Mendonça França
55f9b8129a
Add three new rubocop rules
Style/SpaceBeforeBlockBraces
Style/SpaceInsideBlockBraces
Style/SpaceInsideHashLiteralBraces

Fix all violations in the repository.
2016-08-16 04:30:11 -03:00
Xavier Noria
a9dc45459a code gardening: removes redundant selfs
A few have been left for aesthetic reasons, but have made a pass
and removed most of them.

Note that if the method `foo` returns an array, `foo << 1`
is a regular push, nothing to do with assignments, so
no self required.
2016-08-08 01:12:38 +02:00
Stan Lo
ab2af4dfcb Modify LogSubscriber for single partial's cache message.
Implement naive partial caching mechanism.

Add test for LogSubscriber

Use ActionView::Base#log_payload to store log_subscriber's payload, so we can pass cache result into it.

Fixed tests

Remove useless settings

Check if #log_payload exists before calling it. Because other classes also includes CacheHelper but don't have is attribute

Use @log_payload_for_partial_reder instead of #log_payload to carry ActionView's payload.

Update test's hash syntax

Add configuration to enable/disable fragment caching logging

Remove unless test and add new test to ensure cache info won't effect next rendering's log

Move :enable_fragment_cache_logging config from ActionView to ActionPack

Apply new config to tests

Update actionview's changelog

Update configuration guide

Improve actionview's changelog

Refactor PartialRenderer#render and log tests

Mute subscriber's log instead of disabling instrumentation.

Fix typo, remove useless comment and use new hash syntax

Improve actionpack's log_subscriber test

Fix rebase mistake

Apply new config to all caching intstrument actions
2016-08-08 00:24:39 +08:00
Ryuta Kamizono
762e3f05f3 Add Style/EmptyLines in .rubocop.yml and remove extra empty lines 2016-08-07 17:50:59 +09:00
Xavier Noria
b326e82dc0 applies remaining conventions across the project 2016-08-06 20:20:22 +02:00
Xavier Noria
80e66cc4d9 normalizes indentation and whitespace across the project 2016-08-06 20:16:27 +02:00
Xavier Noria
b91ff557ef applies new string literal convention in actionmailer/test
The current code base is not uniform. After some discussion,
we have chosen to go with double quotes by default.
2016-08-06 19:03:39 +02:00
Jeremy Daer
e35b98e6f5
Action Mailer: Declarative exception handling with rescue_from.
Follows the same pattern as controllers and jobs. Exceptions raised in
delivery jobs (enqueued by `#deliver_later`) are also delegated to the
mailer's rescue_from handlers, so you can handle the DeserializationError
raised by delivery jobs:

```ruby
class MyMailer < ApplicationMailer
  rescue_from ActiveJob::DeserializationError do
    …
  end
```

ActiveSupport::Rescuable polish:
* Add the `rescue_with_handler` class method so exceptions may be
  handled at the class level without requiring an instance.
* Rationalize `exception.cause` handling. If no handler matches the
  exception, fall back to the handler that matches its cause.
* Handle exceptions raised elsewhere. Pass `object: …` to execute
  the `rescue_from` handler (e.g. a method call or a block to
  instance_exec) against a different object. Defaults to `self`.
2016-05-15 18:44:16 -07:00
Rafael França
063bc008b3 Merge pull request #24589 from vipulnsward/am-fragment-cache
Expand on Action Mailer Fragment caching tests
2016-05-05 16:26:47 -05:00
arktisklada
9d63111499
Clear ActionMailer deliveries on setup and teardown
Signed-off-by: Jeremy Daer <jeremydaer@gmail.com>
2016-04-25 22:41:18 -05:00
Vipul A M
cbb25c4b1c Expand on Action Mailer Fragment caching tests 2016-04-17 23:16:09 +05:30
Jeremy Daer
95e06e6682 Disallow calling #deliver_later after local message modifications.
They would be lost when the delivery job is enqueued, otherwise.
Prevents a common, hard-to-find bug like:

```ruby
message = Notifier.welcome(user, foo)
message.message_id = my_generated_message_id
message.deliver_later
```

The message_id is silently lost here! *Only the mailer arguments are
passed to the delivery job.*

This raises an exception now.

Make modifications to the message within the mailer method or use a
custom Active Job to manage delivery instead of using #deliver_later.
2016-04-07 13:36:50 -07:00
arktisklada
23e4c968d2 Sendmail default arguments match Mail::SendMail
Removes `-t`
2016-04-05 14:11:37 -05:00
yui-knk
5aa6c85c3b Suppress warnings
"Using a dynamic :controller (or :action) segment in a route is deprecated"
by 6520ea5f7e2215a763ca74bf6cfa87be2347d5df (#23980).
2016-03-31 01:07:43 +09:00
Arthur Neves
2abcdfd978 Remove load_paths file 2016-02-27 13:03:57 -05:00
Stan Lo
98fe07a946 Move ActionMailer::Caching's content into ActionMailer::Base instead of including it
Remove useless helper in ActionDispatch::Caching and fix indentation
2016-02-23 21:06:41 -03:00
Stan Lo
3e824d3f5b Move most caching methods to ActionDispatch::Caching, and let ActionMailer and ActionController to include it 2016-02-23 21:06:40 -03:00
Stan Lo
049b6e670f Porting ActionController::Caching to ActionMailer::Caching 2016-02-23 21:04:16 -03:00
yui-knk
8be6a3db7b Remove not used test fixture
'actionmailer/test/mailers/async_mailer.rb' was deleted by
f9da785d0b1b22317cfca25c15fb555e9016accb .
This template is not used now.
2015-12-30 15:33:26 +09:00
Marcus Ilgner
5c54db290f
ActionMailer: support overriding template name in multipart
Implicit rendering in multipart blocks now also uses the template
name from the options hash instead of always using the action name.

So you can now write

    mail(template_name: template_name) do |format|
      format.text
      format.html
    end
2015-12-08 15:50:43 +01:00