1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
Commit graph

1480 commits

Author SHA1 Message Date
Matthew Draper
6c08d480f1 Start Rails 5.2 development 2017-03-22 10:11:39 +10:30
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
Krzysztof Zych
3a6e84715e Document using default_url_options in an ActionMailer class. 2017-03-08 13:34:28 +01: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 .
2017-03-02 08:00:22 +00:00
Rafael Mendonça França
f4acdd83ff
Preparing for 5.1.0.beta1 release 2017-02-23 14:53:21 -05:00
Jon Moss
f4d2bcdd6d Add backticks around constant
[ci skip]
2017-02-21 11:45:50 -05:00
Stan Lo
dde7134e07 Freeze fragment cache related instrument name.
ActionMailer::Base#instrument_name and
ActionController::Base#instrument_name will be frequently called once
caching is enabled. So it's better to freeze them instead of create new
string on every call.

Also, the instrument name in #instrument_fragment_cache will usually
be "write_fragment.action_controller" or
"read_fragment.action_controller". So freezing them might also gain some
performance improvement. We have done something like this in other places:
https://github.com/rails/rails/blob/master/actionview/lib/action_view/template.rb#L348
2017-02-07 00:41:02 +08:00
yuuji.yaginuma
53b98f1dda Add :args to process.action_mailer event 2017-02-04 11:43:24 +09:00
Eugene Kenny
ebededb372
Don't mutate raw_source in mailer preview interceptor
The raw_source method is documented as returning the exact value that
was used to create the body; mutating it breaks that contract.

Additionally, if the value used to create the body is blank, raw_source
returns a frozen string which causes the interceptor to raise an error.
2017-01-30 22:20:47 -07:00
yuuji.yaginuma
18cc66cef6 add default value to deliver_later_queue_name option [ci skip] 2017-01-31 10:23:21 +09:00
Rafael Mendonça França
2dadf73891
Document with with an example an link to Parameterized
Also change the class_methods to ClassMethods since the former document
the method as an instance method of Parameterized not as a class method.
2017-01-30 13:38:12 -05:00
Rafael Mendonça França
d3cb00b87e
✂️ 2017-01-30 13:38:06 -05:00
Rafael Mendonça França
bfda627713
No need to advertise in the rdoc documentation 2017-01-30 13:31:11 -05: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
Rafael Mendonça França
bfc69e873d
Remove unneeded nodoc 2017-01-30 13:17:52 -05:00
Rafael Mendonça França
58f9c4f096
Override the initializers instead of using tap
We own the class so we can override the initialize.
2017-01-30 13:02:30 -05:00
Rafael Mendonça França
04b59ec930
Make internal classes internal for the documentation 2017-01-30 13:02:11 -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
Kasper Timm Hansen
e552db0588 [ci skip] other -> order; expand ivar 2017-01-28 19:00:54 +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 ()
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
aaece61a53 ZOMG worst typo in my life 😱 2017-01-15 05:16:53 +09:00
Akira Matsuda
ec513098fe respond_to_missing? should fallback to super where method_missing could call super 2017-01-15 03:58:19 +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 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
MQuy
f091bd67b3 Remove unnecessary condition in content_type 2017-01-06 18:37:33 +08:00
Akira Matsuda
5473e390d3 self. is not needed when calling its own instance method
Actually, private methods cannot be called with `self.`, so it's not just redundant, it's a bad habit in Ruby
2017-01-05 19:58:52 +09:00
Rafael Mendonça França
b6ffb5efcb
Revert "Merge pull request from mtsmfm/fix-generator-command-for-nested-rails-engine"
This reverts commit 1e969bfb98, reversing
changes made to a5041f267d.

Reason: It breaks the public API
2017-01-03 21:51:18 -05:00
Rafael França
1e969bfb98 Merge pull request from mtsmfm/fix-generator-command-for-nested-rails-engine
Fix generator command for nested (namespaced) rails engine
2017-01-03 21:45:25 -05:00
Rafael Mendonça França
7339547602
Remove unneeded Deprecation.silence 2017-01-03 20:54:34 -05:00
Fumiaki MATSUSHIMA
085546df45 Fix generator command for nested (namespaced) rails engine
If we create nested (namespaced) rails engine such like bukkits-admin,
`bin/rails g scaffold User name:string age:integer`
will create
`bukkits-admin/app/controllers/bukkits/users_controller.rb`
but it should create
`bukkits-admin/app/controllers/bukkits/admin/users_controller.rb`.

In , we changed `namespaced_path` as root path
because we supposed application_controller is always in root
but nested rails engine's application_controller will not.
2017-01-03 21:18:09 +09:00
Jon Moss
37d956f45f Bump license years for 2017
Per https://www.timeanddate.com/counters/firstnewyear.html, it's already
2017 in a lot of places, so we should bump the Rails license years to
2017.

[ci skip]
2016-12-31 08:34:08 -05:00
Akira Matsuda
8c7e82e8e0 Privatize unneededly protected methods in Action Mailer 2016-12-24 21:01:07 +09:00
Akira Matsuda
bbbc3e1619 No need to nodoc private method 2016-12-24 21:01:06 +09:00
Akira Matsuda
8e1da1188f Privatize unneededly protected methods in Action Mailer tests 2016-12-24 00:15:11 +09:00
MQuy
40b1f648b9 Add document in mailer 2016-12-06 13:47:51 +08:00
MQuy
36efba0520 Fix wrong typo in test 2016-12-05 21:47:49 +08:00
MQuy
2263769c79 Add changelog for custom content type 2016-12-01 10:18:00 +08:00
MQuy
c4639b7737 allow context type when set body mail 2016-11-30 22:18:14 +08:00
Yves Senn
2b4a9735d8 update bin/test scripts to prevent double runs.
The test runner was updated to make use of autorun. This caused the
`bin/test` scripts to run Minitest twice.
2016-11-21 17:25:12 +01: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
Ryuta Kamizono
3464cd5c28 Fix broken comments indentation caused by rubocop auto-correct [ci skip]
All indentation was normalized by rubocop auto-correct at 80e66cc4d9.
But comments was still kept absolute position. This commit aligns
comments with method definitions for consistency.
2016-09-14 18:26:32 +09:00
Xavier Noria
810dff7c9f RuboCop is 100% green 🎉 2016-09-02 00:43:33 +02:00
Xavier Noria
bb1ecdcc67 fixes remaining RuboCop issues [Vipul A M, Xavier Noria] 2016-09-01 23:41:49 +02:00
Rafael Mendonça França
0510208dd1
Add load hooks to all tests classes
Usually users extends tests classes doing something like:

    ActionView::TestCase.include MyCustomTestHelpers

This is bad because it will load the ActionView::TestCase right aways
and this will load ActionController::Base making its on_load hooks to
execute early than it should.

One way to fix this is using the on_load hooks of the components like:

    ActiveSupport.on_load(:action_view) do
      ActionView::TestCase.include MyCustomTestHelpers
    end

The problem with this approach is that the test extension will be only
load when ActionView::Base is loaded and this may happen too late in the
test.

To fix this we are adding hooks to people extend the test classes that
will be loaded exactly when the test classes are needed.
2016-08-25 04:22:48 -03:00