aboutsummaryrefslogtreecommitdiffstats
path: root/actionmailer/test
Commit message (Collapse)AuthorAgeFilesLines
* applies new string literal convention in actionmailer/testXavier Noria2016-08-0617-257/+257
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* Action Mailer: Declarative exception handling with `rescue_from`.Jeremy Daer2016-05-152-1/+70
| | | | | | | | | | | | | | | | | | | | | | | 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`.
* Merge pull request #24589 from vipulnsward/am-fragment-cacheRafael França2016-05-055-3/+62
|\ | | | | Expand on Action Mailer Fragment caching tests
| * Expand on Action Mailer Fragment caching testsVipul A M2016-04-175-3/+62
| |
* | Clear ActionMailer deliveries on setup and teardownarktisklada2016-04-251-0/+38
|/ | | | Signed-off-by: Jeremy Daer <jeremydaer@gmail.com>
* Disallow calling `#deliver_later` after local message modifications.Jeremy Daer2016-04-071-0/+8
| | | | | | | | | | | | | | | | | | | 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.
* Sendmail default arguments match Mail::SendMailarktisklada2016-04-051-1/+1
| | | | Removes `-t`
* Suppress warningsyui-knk2016-03-312-6/+12
| | | | | "Using a dynamic :controller (or :action) segment in a route is deprecated" by 6520ea5f7e2215a763ca74bf6cfa87be2347d5df (#23980).
* Remove load_paths fileArthur Neves2016-02-271-1/+0
|
* Move ActionMailer::Caching's content into ActionMailer::Base instead of ↵Stan Lo2016-02-231-2/+0
| | | | | | including it Remove useless helper in ActionDispatch::Caching and fix indentation
* Move most caching methods to ActionDispatch::Caching, and let ActionMailer ↵Stan Lo2016-02-231-1/+0
| | | | and ActionController to include it
* Porting ActionController::Caching to ActionMailer::CachingStan Lo2016-02-236-0/+257
|
* Remove not used test fixtureyui-knk2015-12-301-1/+0
| | | | | | 'actionmailer/test/mailers/async_mailer.rb' was deleted by f9da785d0b1b22317cfca25c15fb555e9016accb . This template is not used now.
* Revert "Merge pull request #18446 from ↵Sean Griffin2015-11-231-78/+0
| | | | | | | | | cloud8421/actionmailer-unregister-interceptor" This reverts commit 65a61ab7c370d2894c11ce276725f723a5c9c111, reversing changes made to 14314ca18302f18c3d8bb7a63e9f71ac4c2290c2. This PR broke the build
* Merge pull request #18446 from cloud8421/actionmailer-unregister-interceptorSean Griffin2015-11-231-0/+78
|\ | | | | | | ActionMailer::Base can unregister interceptor(s).
| * ActionMailer::Base can unregister interceptor(s).Claudio Ortolina2015-01-311-0/+78
| | | | | | | | | | | | | | | | | | | | | | | | 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`. Refactors logic to constantize a string/symbol into separate method.
* | tests, define `Rails.root` before loading Action Mailer.Yves Senn2015-11-042-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | Delete needless `require 'active_support/deprecation'`yui-knk2015-10-201-1/+0
| | | | | | | | | | When `require 'active_support/rails'`, 'active_support/deprecation' is automatically loaded.
* | Added assertion for error messages for nil and unknown delivery methodsRonak Jangir2015-09-221-2/+4
| | | | | | As `deliver_now` `RuntimeError` for both nil & unknown delivery method so it’s good to have assertion for error messages
* | change test method name to the appropriate nameyuuji.yaginuma2015-09-191-1/+1
| |
* | Added test for `any` if called without specifying any format Ronak Jangir2015-09-182-0/+13
| | | | | | | | | | | | | | | | Example ````ruby mail(hash) do |format| format.any end ````
* | Removed duplicate requiring minitest/mock as it is already required in ↵Ronak Jangir2015-08-261-1/+0
| | | | | | | | method_call_assertions
* | Removed mocha from ActionMailerRonak Jangir2015-08-204-55/+100
| |
* | Make silence a warning inserted by commit #4b3f8acyui-knk2015-07-301-1/+4
| |
* | Revert "Merge pull request #20758 from ↵Kasper Timm Hansen2015-07-071-14/+6
| | | | | | | | | | | | | | xijo/action_mailer_message_delivery_respects_i18n_locale" This reverts commit f2a8c23654d69dd8f294971487b5abf0e5d891c3, reversing changes made to 3046c9bbe154aa717a5147091be8b495ed8969c4.
* | ActionMailer::MessageDelivery respects current I18n.localeJohannes Opper2015-07-051-6/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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`.
* | Merge pull request #18587 from ↵Rafael Mendonça França2015-06-031-0/+14
|\ \ | | | | | | | | | | | | | | | chrismcg/allow_deliver_later_queue_name_to_be_configured Allow configuration of ActionMailer queue name
| * | Allow configuration of ActionMailer queue nameChris McGrath2015-06-021-0/+14
| | |
* | | not require mail fileGaurav Sharma2015-05-291-1/+0
| | | | | | | | | | | | | | | | | | ``` it added in this commit (https://github.com/rails/rails/commit/2a25c4ce6da6ea23ebdf44e7eb2d2441dbea20a1), now no warnings occur. ```
* | | not needed require'sAnkit Gupta2015-05-102-2/+0
| | | | | | | | | | | | | | | - as core_ext is not used and test pass locally - mail is already required in abstract_unit
* | | `assert_emails` in block form use the given number as expected valueyuuji.yaginuma2015-05-091-0/+11
| | |
* | | Make ActionMailer #cache helper a no-op, not an exceptionJavan Makhmali2015-04-281-1/+13
| | |
* | | Revert "Leave all our tests as order_dependent! for now"Matthew Draper2015-03-061-5/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 2f52f969885b2834198de0045748436a4651a94e. Conflicts: actionmailer/test/abstract_unit.rb actionview/test/abstract_unit.rb activemodel/test/cases/helper.rb activerecord/test/cases/helper.rb activesupport/test/abstract_unit.rb railties/test/abstract_unit.rb
* | | Removing unused mailer templatesThiago Pradi2015-03-0118-50/+0
| | |
* | | remove noise from AM testsAditya Kapoor2015-02-071-5/+16
| | |
* | | Removed magic comments # encoding: utf-8 , since its default from ruby 2.0 ↵Vipul A M2015-02-033-3/+0
| | | | | | | | | | | | onwards.
* | | Use public Module#include, in favor of https://bugs.ruby-lang.org/issues/8846robertomiranda2015-01-311-1/+1
|/ / | | | | | | ref: https://github.com/rails/rails/pull/18763#issuecomment-72349769
* / Fix assertion that was never runclaudiob2015-01-111-1/+1
|/ | | | | | | | | | | | In order to run whether the `welcome` method of the ActionMailer::Base subclass raises an error, `message` must be called, otherwise the method is not executed at all. You could just replace with `def welcome; raise StandardError; end` and you would still see a passing test. This commit fixes the test so the assertion is actually executed, just like any other tests in the file, where `.message` is called.
* Add assert_enqueued_emails and assert_no_enqueued_emailsGeorge Claghorn2015-01-081-0/+47
|
* Remove deprecated ActionMailer deliver & deliver!claudiob2015-01-041-19/+0
| | | | | These methods were deprecated in Rails 4.2 (see f4ee1147) so they can be safely removed in Rails 5.0.
* Template lookup now respect default locale and I18n fallbacks.Rafael Mendonça França2014-12-293-1/+28
| | | | | | | | | | | | | | | | | | | | | | | | | Given the following templates: mailer/demo.html.erb mailer/demo.en.html.erb mailer/demo.pt.html.erb Before this change for a locale that doesn't have its related file the `mailer/demo.html.erb` will be rendered even if `en` is the default locale. Now `mailer/demo.en.html.erb` has precedence over the file without locale. Also, it is possible to give a fallback. mailer/demo.pt.html.erb mailer/demo.pt-BR.html.erb So if the locale is `pt-PT`, `mailer/demo.pt.html.erb` will be rendered given the right I18n fallback configuration. Fixes #11884.
* let the AM test suite pass in 1.9Xavier Noria2014-11-241-2/+2
|
* let mailer templates generate URLs by default [Xavier Noria, Richard Schneeman]Xavier Noria2014-11-242-0/+61
|
* Only include the needed assertionsRafael Mendonça França2014-10-071-1/+1
|
* fix tests on action_mailerschneems2014-10-073-6/+8
| | | Include appropriate helpers and use `assert_dom_equal` where applicable
* Allow attaching files while the mail view is renderedChristian Felder (masone)2014-09-222-0/+21
|
* Default to sorting user's test cases for nowGodfrey Chan2014-09-081-1/+1
| | | | | | | | | | | Goals: 1. Default to :random for newly generated applications 2. Default to :sorted for existing applications with a warning 3. Only show the warning once 4. Only show the warning if the app actually uses AS::TestCase Fixes #16769
* Rename remaining :in / :at to :wait / :wait_untilCristian Bica2014-09-041-3/+5
|
* Active Job refactoringCristian Bica2014-09-031-12/+12
|
* Leave all our tests as order_dependent! for nowMatthew Draper2014-09-021-0/+5
| | | | | | | | | We're seeing too many failures to believe otherwise. This reverts commits bc116a55ca3dd9f63a1f1ca7ade3623885adcc57, cbde413df3839e06dd14e3c220e9800af91e83ab, bf0a67931dd8e58f6f878b9510ae818ae1f29a3a, and 2440933fe2c27b27bcafcd9019717800db2641aa.