Commit Graph

487 Commits

Author SHA1 Message Date
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
Ankit Gupta
0e6a67644a not needed require's
- as core_ext is not used and test pass locally
- mail is already required in abstract_unit
2015-05-10 08:42:30 -04:00
yuuji.yaginuma
49a59cc6a5 assert_emails in block form use the given number as expected value 2015-05-09 18:59:59 +09:00
Javan Makhmali
20f6f646d1 Make ActionMailer #cache helper a no-op, not an exception 2015-04-28 13:56:42 -06:00
Matthew Draper
b5eb0b6cc3 Revert "Leave all our tests as order_dependent! for now"
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
2015-03-06 04:38:54 +10:30
Thiago Pradi
bc970e8335 Removing unused mailer templates 2015-03-01 16:07:24 -03:00
Aditya Kapoor
7b58423251 remove noise from AM tests 2015-02-07 13:38:18 +05:30
Vipul A M
6eced6a1fe Removed magic comments # encoding: utf-8 , since its default from ruby 2.0 onwards. 2015-02-03 20:51:40 +05:30
robertomiranda
ce8efcf296 Use public Module#include, in favor of https://bugs.ruby-lang.org/issues/8846
ref: https://github.com/rails/rails/pull/18763#issuecomment-72349769
2015-01-31 23:12:41 -05:00
Claudio Ortolina
ff5fcf65ec ActionMailer::Base can unregister interceptor(s).
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.
2015-01-31 14:25:00 +00:00
claudiob
e4613c97c3 Fix assertion that was never run
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.
2015-01-11 11:50:29 -08:00
George Claghorn
3f17fbd68d Add assert_enqueued_emails and assert_no_enqueued_emails 2015-01-08 09:41:22 -05:00
claudiob
755dcd0691 Remove deprecated ActionMailer deliver & deliver!
These methods were deprecated in Rails 4.2 (see f4ee1147) so they can
be safely removed in Rails 5.0.
2015-01-04 11:58:41 -03:00
Rafael Mendonça França
ecb1981bfd Template lookup now respect default locale and I18n fallbacks.
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.
2014-12-29 23:48:35 -03:00
Xavier Noria
79eedb346e let the AM test suite pass in 1.9 2014-11-24 22:03:54 -08:00
Xavier Noria
9685080a76 let mailer templates generate URLs by default [Xavier Noria, Richard Schneeman] 2014-11-24 14:33:50 -08:00
Rafael Mendonça França
0bd1a4e05c Only include the needed assertions 2014-10-07 20:01:40 -03:00
schneems
e6b0b760cc fix tests on action_mailer
Include appropriate helpers and use `assert_dom_equal` where applicable
2014-10-07 17:40:59 -05:00
Christian Felder (masone)
b37e8482ca Allow attaching files while the mail view is rendered 2014-09-22 15:52:48 +02:00
Godfrey Chan
2b41343c34 Default to sorting user's test cases for now
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
2014-09-08 05:32:16 -07:00
Cristian Bica
15ddf60e05 Rename remaining :in / :at to :wait / :wait_until 2014-09-04 08:08:06 +03:00
Cristian Bica
1e237b4e44 Active Job refactoring 2014-09-03 23:01:46 +03:00
Matthew Draper
2f52f96988 Leave all our tests as order_dependent! for now
We're seeing too many failures to believe otherwise.

This reverts commits bc116a55ca3dd9f63a1f1ca7ade3623885adcc57,
cbde413df3839e06dd14e3c220e9800af91e83ab,
bf0a67931dd8e58f6f878b9510ae818ae1f29a3a, and
2440933fe2c27b27bcafcd9019717800db2641aa.
2014-09-02 23:55:34 +09:30
Abdelkader Boudih
377d0de843 [ActionMailer] Rename test/test_test to test/test_case_test 2014-08-30 14:38:33 +00:00
Robin Dupret
a548e2ba16 Make test:isolated run without bundler for Action Mailer
Action Mailer tests weren't able to run in isolation without the bundle
exec prefix since we were requiring gems before requiring abstract_unit.

We don't need the `gem` call thus and the require_relative since the
test directory should be present in the load path when we run any test.
2014-08-29 12:41:37 +02:00
Akira Matsuda
31abbe5154 Fix SyntaxError 2014-08-21 06:40:00 +09:00
Cristian Bica
f4ee114746 Deprecated .deliver / .deliver! to .deliver_now / .deliver_now! 2014-08-20 17:48:34 +03:00
Akira Matsuda
0df2a83b7f Clear deliveries in order not to affect other tests 2014-08-20 19:07:03 +09:00
Lucas Mazza
63f7b22a4e Remove global helpers from the ActionMailer test suite. 2014-08-19 23:53:19 -03:00
Rafael Mendonça França
c78da4d5c4 Merge branch 'master' into loofah
Conflicts:
	actionpack/CHANGELOG.md
2014-08-17 22:38:22 -03:00
Abdelkader Boudih
2f7b239fca [ActiveJob] Use globalid gem 2014-08-17 23:10:45 +00:00
Abdelkader Boudih
299d1f2626 [ActionMailer] Rename ActionMailer::DelayedDeliveryJob to ActionMailer::DeliveryJob 2014-08-17 23:10:08 +00:00
Abdelkader Boudih
6a2ca149fd [ActiveJob] Fix test syntax 2014-08-17 23:09:42 +00:00
Abdelkader Boudih
18303f6e82 Refactor DeliverLater into MessageDelivery 2014-08-14 11:05:35 +00:00
Cristian Bica
06908e60be Merge branch 'master' into activejob 2014-08-13 22:55:32 +03:00