Commit Graph

521 Commits

Author SHA1 Message Date
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
Sean Griffin
3faf748562 Revert "Merge pull request #18446 from cloud8421/actionmailer-unregister-interceptor"
This reverts commit 65a61ab7c370d2894c11ce276725f723a5c9c111, reversing
changes made to 14314ca18302f18c3d8bb7a63e9f71ac4c2290c2.

This PR broke the build
2015-11-23 15:01:24 -07:00
Sean Griffin
65a61ab7c3 Merge pull request #18446 from cloud8421/actionmailer-unregister-interceptor
ActionMailer::Base can unregister interceptor(s).
2015-11-23 14:29:56 -07:00
Yves Senn
a80fb6f9b3 tests, define Rails.root before loading Action Mailer.
Since `bin/test` would define `Rails.root` before loading AM but `bundle
exec rake` would define it after loading AM, this lead to the following
test failure when using `bin/test`:

```
--- expected
+++ actual
@@ -1 +1 @@
-{:location=>"/var/folders/_r/9kh50y4j0vn7zgg2p65z1lcm0000gn/T/mails"}
+{:location=>"/Users/senny/Projects/rails/actionmailer/tmp/mails"}
```

This patch ensures that `Rails.root` is defined when loading AM to
achieve consistent test results.
2015-11-04 16:35:31 -05:00
yui-knk
1099329be0 Delete needless require 'active_support/deprecation'
When `require 'active_support/rails'`, 'active_support/deprecation'
is automatically loaded.
2015-10-20 20:02:59 +09:00
Ronak Jangir
ecc9473622 Added assertion for error messages for nil and unknown delivery methods
As `deliver_now` `RuntimeError` for both nil & unknown delivery method so it’s good to have assertion for error messages
2015-09-22 19:11:03 +05:30
yuuji.yaginuma
09e3aa62dc change test method name to the appropriate name 2015-09-19 17:33:14 +09:00
Ronak Jangir
fef6c11d2a Added test for any if called without specifying any format
Example
````ruby
mail(hash) do |format|
  format.any
end
````
2015-09-18 22:56:42 +05:30
Ronak Jangir
8d7bf97798 Removed duplicate requiring minitest/mock as it is already required in method_call_assertions 2015-08-26 19:43:54 +05:30
Ronak Jangir
c48257b0af Removed mocha from ActionMailer 2015-08-20 11:27:49 +05:30
yui-knk
6149444685 Make silence a warning inserted by commit #4b3f8ac 2015-07-30 00:42:19 +09:00
Kasper Timm Hansen
062cbd18dd Revert "Merge pull request #20758 from xijo/action_mailer_message_delivery_respects_i18n_locale"
This reverts commit f2a8c23654d69dd8f294971487b5abf0e5d891c3, reversing
changes made to 3046c9bbe154aa717a5147091be8b495ed8969c4.
2015-07-07 22:11:20 +02:00
Johannes Opper
ca2387eb01 ActionMailer::MessageDelivery respects current I18n.locale
When #deliver_now is called all translations within the
generated email will be looked up for the current I18n
locale.

    I18n.locale = ‘de’
    mail.deliver_now # Generates german email, correct

In #enqueue_delivery the locale was not considered and
the resulting job uses the default locale.

    I18n.locale = ‘de’
    mail.deliver_later # Generate english email, incorrect

In order to achieve a consistent behaviour the current locale
is now always passed to `ActionMailer::DeliveryJob`.
2015-07-05 20:21:25 +02:00
Rafael Mendonça França
cecbf9ed32 Merge pull request #18587 from chrismcg/allow_deliver_later_queue_name_to_be_configured
Allow configuration of ActionMailer queue name
2015-06-03 13:25:32 -03:00
Chris McGrath
f5a131aaea Allow configuration of ActionMailer queue name 2015-06-02 10:49:49 +01:00
Gaurav Sharma
baa773a520 not require mail file
```
  it added in this commit (2a25c4ce6d), now no warnings occur.
  ```
2015-05-29 21:25:28 +05:30