Commit Graph

1526 Commits

Author SHA1 Message Date
Dwight Watson
908aaa650e Sort mailer previews 2017-11-14 10:16:27 +11:00
Rafael Mendonça França
8dd76a7a6f
Use .tt extension to all the template files
Make clear that the files are not to be run for interpreters.

Fixes #23847.
Fixes #30690.
Closes #23878.
2017-11-13 15:23:28 -05: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
Akira Matsuda
a53a52d8ca [Action Mailer] require_relative => require
This basically reverts cd9cc721ab54e2b0c7875cacf2113f03908a8bb7
2017-10-21 22:48:28 +09:00
Ryuta Kamizono
fced30c373 Cleanup CHANGELOGs [ci skip]
* Add missing credit
* Add backticks
* Fix indentation
* Remove trailing spaces

And some minor tweaks.
2017-10-04 07:27:33 +09:00
Mikkel Malmberg
db6847dcb6 Add assert_enqueued_email_with to ActionMailer::TestHelper 2017-09-27 23:22:49 +02:00
Yoshiyuki Hirano
413bb9bd34 Update Action Mailer doc [ci skip] 2017-08-30 03:29:41 +09:00
Yoshiyuki Hirano
70f75caaa3 Use tt in doc for action_mailer [ci skip] 2017-08-26 08:40:18 +09:00
Rafael Mendonça França
783295f706 Merge pull request #30213 from ckundo/ccundiff-alt-text-default
Do not generate default alt text for images
2017-08-23 11:51:34 -04:00
Yoshiyuki Hirano
3a11e0586e Update MIT licenses link [ci skip] 2017-08-22 08:46:02 +09: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 França
b9e0b4f199 Merge pull request #29559 from kirs/eager-load-controller-actions
Eager load controller actions to reduce response time of the first request
2017-08-11 17:54:04 -04:00
Youssef Boulkaid
d33bdef821 Remove outdated comment [ci skip]
The comment was describing a previous version of the method with
a different signature. This is outdated since e76c38e
2017-08-06 04:20:16 +02: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
0668c22a41 Eager load controller and mailer actions
On the first request, ActionController::Base#action_methods computes
and memoized the list of available actions [1]. With this PR we move
this expensive operation into eager load step to reduce response time
of the first request served in production.

This also reduces the memory footprint when running on forking server
like Unicorn.

[1] a3813dce9a/actionpack/lib/abstract_controller/base.rb (L66-L77)
2017-07-29 14:03:52 +03: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
Xavier Noria
92c29d82eb Merge branch 'master' into require_relative_2017 2017-07-02 13:50:25 -07: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
Matthew Draper
afb66a5a59 Merge pull request #29506 from pat/frozen-string-literals
Make ActiveSupport frozen-string-literal friendly.
2017-07-02 01:07:12 +09:30
Akira Matsuda
cd9cc721ab [Action Mailer] require => require_relative 2017-07-01 18:38:05 +09:00
Kir Shatrov
cfade1ec7e Enforce frozen string in Rubocop 2017-07-01 02:11:03 +03:00
Grey Baker
3e6ce1cd69 Add source code and changelog links to gemspecs 2017-06-28 10:06:01 +01:00
Pat Allan
dd491b24ff Make ActionMailer frozen string literal friendly. 2017-06-20 19:45:46 +10:00
Ryuta Kamizono
6bb7d50dec Fix formatting of ActionMailer::MessageDelivery doc [ci skip] 2017-06-16 10:33:53 +09:00
Matthew Mongeau
425e351a5e Document setting the delivery_job for ActionMailer [ci skip] 2017-06-16 10:13:40 +09:00
Ryuta Kamizono
6e227ad345 Fix indentation [ci skip] 2017-06-15 21:44:19 +09: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
bogdanvlviv
6673cf7071
Use require_relative instead of require with full path 2017-06-14 12:10:17 +03:00
Genadi Samokovarov
b6b0c99ff3 Use mattr_accessor default: option throughout the project 2017-06-03 13:52:48 +03:00
Kasper Timm Hansen
e1758b5e8c Merge branch 'master' into unlock-minitest 2017-05-29 20:37:35 +02:00
David Heinemeier Hansson
1c275d812f Add option for class_attribute default (#29270)
* Allow a default value to be declared for class_attribute

* Convert to using class_attribute default rather than explicit setter

* Removed instance_accessor option by mistake

* False is a valid default value

* Documentation
2017-05-29 18:01:50 +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 França
a23846e0ab Merge pull request #28835 from fphilipe/master
Add missing require in ActionMailer::Base
2017-05-02 11:16:53 -07:00
Philipe Fatio
eddbb62f94
Add missing require in ActionMailer
Without this, Action Mailer doesn't work like it used to on version 4.
The following snippet fails since version 5:

    > require 'action_mailer'
    > ActionMailer::Base
    NameError: uninitialized constant ActiveSupport::Rescuable
2017-05-02 07:22:48 +02: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
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 #27457.
2017-03-02 08:00:22 +00:00