aboutsummaryrefslogtreecommitdiffstats
path: root/actionmailer/test/base_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* Privatize unneededly protected methods in Action Mailer testsAkira Matsuda2016-12-241-1/+1
|
* Add three new rubocop rulesRafael Mendonça França2016-08-161-7/+7
| | | | | | | | Style/SpaceBeforeBlockBraces Style/SpaceInsideBlockBraces Style/SpaceInsideHashLiteralBraces Fix all violations in the repository.
* code gardening: removes redundant selfsXavier Noria2016-08-081-2/+2
| | | | | | | | | 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.
* Add `Style/EmptyLines` in `.rubocop.yml` and remove extra empty linesRyuta Kamizono2016-08-071-1/+0
|
* normalizes indentation and whitespace across the projectXavier Noria2016-08-061-9/+9
|
* applies new string literal convention in actionmailer/testXavier Noria2016-08-061-81/+81
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* 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.
* | 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-181-0/+7
| | | | | | | | | | | | | | | | Example ````ruby mail(hash) do |format| format.any end ````
* | Removed mocha from ActionMailerRonak Jangir2015-08-201-40/+71
| |
* | Removed magic comments # encoding: utf-8 , since its default from ruby 2.0 ↵Vipul A M2015-02-031-1/+0
| | | | | | | | onwards.
* | 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.
* Template lookup now respect default locale and I18n fallbacks.Rafael Mendonça França2014-12-291-1/+26
| | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Only include the needed assertionsRafael Mendonça França2014-10-071-1/+1
|
* fix tests on action_mailerschneems2014-10-071-2/+4
| | | Include appropriate helpers and use `assert_dom_equal` where applicable
* Allow attaching files while the mail view is renderedChristian Felder (masone)2014-09-221-0/+14
|
* Deprecated .deliver / .deliver! to .deliver_now / .deliver_now!Cristian Bica2014-08-201-18/+18
|
* [ActiveJob] Use globalid gemAbdelkader Boudih2014-08-171-1/+0
|
* Refactor DeliverLater into MessageDeliveryAbdelkader Boudih2014-08-141-2/+3
|
* use :test delivery method for `base_test.rb`Yves Senn2014-08-131-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This solves errors like: ``` BaseTest#test_you_can_register_multiple_observers_to_the_mail_object_that_both_get_informed_on_email_delivery: Errno::ECONNREFUSED: Connection refused - connect(2) for "localhost" port 25 /Users/senny/.rbenv/versions/2.1.2/lib/ruby/2.1.0/net/smtp.rb:541:in `initialize' /Users/senny/.rbenv/versions/2.1.2/lib/ruby/2.1.0/net/smtp.rb:541:in `open' /Users/senny/.rbenv/versions/2.1.2/lib/ruby/2.1.0/net/smtp.rb:541:in `tcp_socket' /Users/senny/.rbenv/versions/2.1.2/lib/ruby/2.1.0/net/smtp.rb:551:in `block in do_start' /Users/senny/.rbenv/versions/2.1.2/lib/ruby/2.1.0/timeout.rb:91:in `block in timeout' /Users/senny/.rbenv/versions/2.1.2/lib/ruby/2.1.0/timeout.rb:101:in `call' /Users/senny/.rbenv/versions/2.1.2/lib/ruby/2.1.0/timeout.rb:101:in `timeout' /Users/senny/.rbenv/versions/2.1.2/lib/ruby/2.1.0/net/smtp.rb:550:in `do_start' /Users/senny/.rbenv/versions/2.1.2/lib/ruby/2.1.0/net/smtp.rb:520:in `start' /Users/senny/Projects/rails/.bundle/gems/mail-2.6.1/lib/mail/network/delivery_methods/smtp.rb:112:in `deliver!' /Users/senny/Projects/rails/.bundle/gems/mail-2.6.1/lib/mail/message.rb:2136:in `do_delivery' /Users/senny/Projects/rails/.bundle/gems/mail-2.6.1/lib/mail/message.rb:232:in `block in deliver' /Users/senny/Projects/rails/actionmailer/lib/action_mailer/base.rb:528:in `block in deliver_mail' /Users/senny/Projects/rails/activesupport/lib/active_support/notifications.rb:164:in `block in instrument' /Users/senny/Projects/rails/activesupport/lib/active_support/notifications/instrumenter.rb:20:in `instrument' /Users/senny/Projects/rails/activesupport/lib/active_support/notifications.rb:164:in `instrument' /Users/senny/Projects/rails/actionmailer/lib/action_mailer/base.rb:526:in `deliver_mail' /Users/senny/Projects/rails/.bundle/gems/mail-2.6.1/lib/mail/message.rb:232:in `deliver' /Users/senny/Projects/rails/actionmailer/test/base_test.rb:598:in `block (2 levels) in <class:BaseTest>' /Users/senny/Projects/rails/actionmailer/test/base_test.rb:801:in `mail_side_effects' /Users/senny/Projects/rails/actionmailer/test/base_test.rb:593:in `block in <class:BaseTest>' ``` where the `:smtp` delivery method was leaked over to other test cases.
* Raise an exception when attachments are added after `mail` was called.Yves Senn2014-07-291-0/+39
| | | | | | | | | Closes #16163 Adding attachments after a call to `mail` will result in invalid emails. This is related to the fact, that `mail` is making the required preparations before the email is ready to be sent. These change depending on your added attachments.
* Fix state leaks in actionmailer/test/base_test.rb.Zuhao Wan2014-05-071-102/+157
|
* Fix MailerPreview broken testsArthur Neves2014-03-151-4/+4
| | | | | | | | | | | `BaseMailerPreview.welcome` is an instance method, so we need to stub the method on a instance level and not on Class. The stub is important to make sure the Message object is the same in the other expectations. This was working randomly because Mocha uses == to compare two objects on the `with()` expectation and even if the Mail::Message objects were not the same object they are equal, but thats not the case in 100% of the runs. So we need to make sure we use `.any_instance` method and have the right message object.
* Make sure we clean preview_interceptorsArthur Neves2014-03-071-0/+1
| | | | We should make sure we clean preview_interceptors after each test so they dont leaky to the next test
* Support underscored symbols in Action Mailer configAndrew White2014-01-261-0/+14
| | | | | | We allow the use of underscored symbols to represent classes throughout other parts of Rails so it seems incongruous that it's not supported in `register_interceptor` and `register_observer`.
* Add the ability to intercept emails before previewingAndrew White2014-01-261-3/+42
| | | | | | | | | | | | | | | | To support the ability for tools like CSS style inliners to operate on emails being previewed this commit adds a hook in a similar fashion to the existing delivery interceptor hook, e.g: class CSSInlineStyler def self.previewing_email(message) # inline CSS styles end end ActionMailer::Base.register_preview_interceptor CSSInlineStyler Fixes #13622.
* `mail()` without arguments is a getter for the current mail.Yves Senn2013-12-021-0/+21
| | | | | | | | | | | | | | This behavior is documented in our guides (http://edgeguides.rubyonrails.org/action_mailer_basics.html#action-mailer-callbacks) but was broken in the past. This commit short curcuits the `mail` method if: 1. mail() was previously called 2. no headers are passed 3. no block is passed Closes #13090. /cc @pixeltrix
* don't convert mailer default values to procsAlex Tsukernik2013-07-221-0/+4
| | | | | | Invoke mailer defaults as procs only if they are procs, do not convert with to_proc. That an object is convertible to a proc does not mean it's meant to be always used as a proc. Fixes #11533
* Allow passing interpolations to `#default_i18n_subject`, e.g.:Olek Janiszewski2013-01-241-0/+6
| | | | | | | | | | | | | | | # config/locales/en.yml en: user_mailer: welcome: subject: 'Hello, %{username}' # app/mailers/user_mailer.rb class UserMailer < ActionMailer::Base def welcome(user) mail(subject: default_i18n_subject(username: user.name)) end end
* Move background jobs to the 'jobs' branch until fully baked. Not shipping ↵Jeremy Kemper2012-12-211-13/+0
| | | | with Rails 4.0.
* Merge pull request #8450 from senny/8448_mailer_return_valuesRafael Mendonça França2012-12-101-0/+6
|\ | | | | the return value of mailer methods should not be relevant
| * The return value from mailer methods is not relevant.Yves Senn2012-12-101-0/+6
| |
* | use _action callbacks in actionmailerFrancesco Rodriguez2012-12-081-10/+10
|/
* Explicit multipart messages respect :parts_orderNate Berkopec2012-11-191-21/+21
| | | | | | | | | As issue #7978, the order in which ActionMailer sends multipart messages could be unintentionally overwritten if a block is passed to the mail method. This changes the mail method such that :parts_order is always respected, regardless of whether a block is passed to mail.
* Revert "Support `Mailer.deliver_foo(*args)` as a synonym for ↵Jon Leighton2012-10-301-7/+0
| | | | | | | | | | | | `Mailer.foo(*args).deliver`." This reverts commit 7e0cf563639bc7508da381b1b8321c7a89be1aa8. Conflicts: actionmailer/CHANGELOG.md See discussion at https://github.com/rails/rails/commit/7e0cf563639bc7508da381b1b8321c7a89be1aa8#commitcomment-2075489
* Do not render views when mail() isn't called. (NullMail refactoring)Yves Senn2012-10-281-0/+6
|
* Update actionmailer with new hash syntax.Kirill Nikitin2012-10-071-32/+32
|
* Support `Mailer.deliver_foo(*args)` as a synonym for ↵Jon Leighton2012-09-281-0/+7
| | | | | | | `Mailer.foo(*args).deliver`. This makes it easy to write e.g. `Mailer.expects(:deliver_foo)` when testing code that calls the mailer.
* Use synchronous queue by default. Separate queued message delivery jobs from ↵Jeremy Kemper2012-09-161-16/+7
| | | | the queued message wrappers so the queue itself needn't be marshaled (due to queue reference QueuedMessage).
* Move queue classes to ActiveSupportSantiago Pastorino2012-09-141-2/+2
|
* Action Mailer async flag is true by default using a Synchronous implSantiago Pastorino2012-09-111-3/+3
|
* Added missing require. When performing rake test:isolated, test/base_test.rb ↵kennyj2012-08-291-0/+1
| | | | was break.
* Fix ActionMailer tests that depend on run orderFrancesco Rodriguez2012-08-231-5/+9
|
* Fix failing AM test due to missing templateCarlos Antonio da Silva2012-07-061-1/+1
|
* Introduce config.action_mailer.default_from=Robert Pankowecki2012-07-031-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | Allows to easily set :from, :replay_to, etc. options in config/application.rb using simple syntax: config.action_mailer.default_options = {from:"no-replay@example.org"} This was not possible using #default method because config.action_mailer.default(from: "no-replay@example.org") is interpreated as reader method and just returns nil. It would not call ActionMailer::Base.default method. The only way of calling this method from config/application.rb was to use the direct syntax which looks ugly in my opinion: config.assets.enabled = false config.assets.version = '1.0' config.encoding = "utf-8" config.action_mailer.default_url_options= { host:"example.org", protocol:"https" } ActionMailer::Base.default(from: "no-replay@example.org")
* Some final syntax fixesBrian Cardarella2012-06-241-2/+1
|
* Forcing the message sending is no longer necessaryBrian Cardarella2012-06-241-9/+0
|
* Support for custom queues on the mailerBrian Cardarella2012-06-231-5/+16
| | | | Credit goes to *Aaron Patterson* (tenderlove)