rails--rails/actionmailer/test
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
..
fixtures Expand on Action Mailer Fragment caching tests 2016-04-17 23:16:09 +05:30
mailers Offer the option to use parameterization for shared processing of headers and ivars (#27825) 2017-01-28 11:20:46 +01:00
abstract_unit.rb Don't pollute Object with rubinius_skip and jruby_skip 2017-01-17 18:51:50 +09:00
assert_select_email_test.rb Remove deprecated support to :text in render 2016-10-10 00:02:52 -03:00
asset_host_test.rb applies remaining conventions across the project 2016-08-06 20:20:22 +02:00
base_test.rb Add `:args` to `process.action_mailer` event 2017-02-04 11:43:24 +09:00
caching_test.rb Add three new rubocop rules 2016-08-16 04:30:11 -03:00
delivery_methods_test.rb Add more rubocop rules about whitespaces 2016-10-29 01:17:49 -02:00
i18n_with_controller_test.rb Remove unneeded Deprecation.silence 2017-01-03 20:54:34 -05:00
log_subscriber_test.rb applies new string literal convention in actionmailer/test 2016-08-06 19:03:39 +02:00
mail_helper_test.rb Reduce string objects by using \ instead of + or << for concatenating strings 2017-01-12 17:45:37 +09:00
mail_layout_test.rb applies new string literal convention in actionmailer/test 2016-08-06 19:03:39 +02:00
message_delivery_test.rb Deprecate implicit coercion of `ActiveSupport::Duration` 2017-03-02 08:00:22 +00:00
parameterized_test.rb Avoid should in test names 2017-01-30 13:28:31 -05:00
test_case_test.rb applies new string literal convention in actionmailer/test 2016-08-06 19:03:39 +02:00
test_helper_test.rb Make assert_enqueued_emails + assert_no_enqueued_emails consider parameterized delivery jobs 2017-01-30 13:41:08 +01:00
url_test.rb Add more rubocop rules about whitespaces 2016-10-29 01:17:49 -02:00