aboutsummaryrefslogtreecommitdiffstats
path: root/actionmailer
Commit message (Collapse)AuthorAgeFilesLines
* Deliver parameterized mail with DeliveryJobGannon McGibbon2018-11-229-51/+50
| | | | | Deliver parameterized mail with `ActionMailer::DeliveryJob` and remove `ActionMailer::Parameterized::DeliveryJob`.
* Fix ActionMailer assertion not working for mail defining delivery_job:Edouard CHIN2018-11-213-5/+70
| | | | | | | | | | | | | | | | | | | - If a Mail defines a custom delivery_job, all ActionMailer assertion helper (assert_emails, assert_enqueued_emails ...) wouldn't work. ```ruby MyMailer < ApplicationMailer self.delivery_job = MyJob end # This assertion will fail assert_emails(1) do MyMailer.my_mail.deliver_later end This PR leverage the new ActiveJob feature that accepts Procs for the `only` keyword and check if the delivery job is one of ActionMailer registered ones.
* Merge pull request #22534 from evopark/masterRafael Mendonça França2018-11-194-3/+26
|\ | | | | | | ActionMailer: support overriding template name in multipart
| * ActionMailer: support overriding template name in multipartMarcus Ilgner2015-12-084-3/+26
| | | | | | | | | | | | | | | | | | | | | | | | Implicit rendering in multipart blocks now also uses the template name from the options hash instead of always using the action name. So you can now write mail(template_name: template_name) do |format| format.text format.html end
* | Amend CVE note and security guide section wordingsGannon McGibbon2018-11-061-3/+3
| | | | | | | | | | | | | | Reword first sentence of dep management and CVE section of security guide. Also, reword and move gemspec notes above deps. [ci skip]
* | Add CVE note to security guide and gemspecsGannon McGibbon2018-11-061-0/+3
| | | | | | | | [ci skip]
* | Fix tests on Mail 2.7.1yuuji.yaginuma2018-10-141-4/+4
| | | | | | | | | | | | | | | | | | | | | | Up to `2.7.0`, encoding was chosen using `Mail::Encodings::TransferEncoding.negotiate`, and base64 encoding was used. In `2.7.1`, when `transfer_encoding` is not specified, the encoding of the message is respected. Related to: https://github.com/mikel/mail/commit/dead487e02f592d9058fd07deedcde39b569d18d However, what chosen for transfer encoding is not essential in these tests. To test more accurately, confirm that the decoded body instead.
* | Parameterized mailers can configure delivery jobLuke Pearce2018-10-054-1/+27
| | | | | | | | | | | | | | | | | | | | Setting parameterized_delivery_job on a mailer class will cause Parameterized::MessageDelivery to use the specified job instead of ActionMailer::Parameterized::DeliveryJob: class MyMailer < ApplicationMailer self.parameterized_delivery_job = MyCustomDeliveryJob ... end
* | Fix spellings for 'unmarshall(ing/ed)' & 'marshall(ing/ed)'Sharang Dashputre2018-10-021-1/+1
| |
* | Add `Style/RedundantFreeze` to remove redudant `.freeze`Yasuo Honda2018-09-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since Rails 6.0 will support Ruby 2.4.1 or higher `# frozen_string_literal: true` magic comment is enough to make string object frozen. This magic comment is enabled by `Style/FrozenStringLiteralComment` cop. * Exclude these files not to auto correct false positive `Regexp#freeze` - 'actionpack/lib/action_dispatch/journey/router/utils.rb' - 'activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb' It has been fixed by https://github.com/rubocop-hq/rubocop/pull/6333 Once the newer version of RuboCop released and available at Code Climate these exclude entries should be removed. * Replace `String#freeze` with `String#-@` manually if explicit frozen string objects are required - 'actionpack/test/controller/test_case_test.rb' - 'activemodel/test/cases/type/string_test.rb' - 'activesupport/lib/active_support/core_ext/string/strip.rb' - 'activesupport/test/core_ext/string_ext_test.rb' - 'railties/test/generators/actions_test.rb'
* | Change the empty block style to have space inside of the blockRafael Mendonça França2018-09-251-1/+1
| |
* | Merge pull request #33974 from rails/remove-catch-all-from-amAaron Patterson2018-09-251-17/+7
|\ \ | | | | | | This patch removes deprecated catch-all routes from AM
| * | This patch removes deprecated catch-all routes from AMAaron Patterson2018-09-241-17/+7
| | | | | | | | | | | | It also removes a monkey patch from AM::Base
* | | Merge pull request #33949 from sjain1107/no-private-defKasper Timm Hansen2018-09-231-8/+10
|\ \ \ | | | | | | | | Remove private def
| * | | Remove private defSakshi Jain2018-09-231-8/+10
| |/ /
* / / Enable `Performance/UnfreezeString` copyuuji.yaginuma2018-09-231-2/+2
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In Ruby 2.3 or later, `String#+@` is available and `+@` is faster than `dup`. ```ruby # frozen_string_literal: true require "bundler/inline" gemfile(true) do source "https://rubygems.org" gem "benchmark-ips" end Benchmark.ips do |x| x.report('+@') { +"" } x.report('dup') { "".dup } x.compare! end ``` ``` $ ruby -v benchmark.rb ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux] Warming up -------------------------------------- +@ 282.289k i/100ms dup 187.638k i/100ms Calculating ------------------------------------- +@ 6.775M (± 3.6%) i/s - 33.875M in 5.006253s dup 3.320M (± 2.2%) i/s - 16.700M in 5.032125s Comparison: +@: 6775299.3 i/s dup: 3320400.7 i/s - 2.04x slower ```
* | Add changelog entries for #33849 [ci skip]bogdanvlviv2018-09-131-0/+4
| | | | | | | | | | | | | | Since these changes related to the public API, I think we should add changelog entries. Related to #33838, #33849
* | Include test helpers when ActionDispatch::IntegrationTest is loadedRicardo Díaz2018-09-121-1/+4
| | | | | | | | | | | | | | | | | | | | | | As @dhh brings up, the point of `ActionDispatch::IntegrationTest` is to allow users to test the integration of all the pieces called by a controller. Asserting about the emails and jobs queued is part of that task. This commit includes the `ActionMailer::TestHelper` and `ActiveJob::TestHelper` modules when the ActionMailer and ActiveJob railties are initialized respectively.
* | Add `perform_deliveries` to a payload of `deliver.action_mailer` notification.Yoshiyuki Kinjo2018-09-094-15/+27
| |
* | Skip delivery notification when perform_deliveries is false.Yoshiyuki Kinjo2018-09-084-0/+21
| |
* | Fix the obvious typos detected by github.com/client9/misspellKazuhiro Sera2018-08-081-1/+1
| |
* | Turn on performance based copsDillon Welch2018-07-231-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use attr_reader/attr_writer instead of methods method is 12% slower Use flat_map over map.flatten(1) flatten is 66% slower Use hash[]= instead of hash.merge! with single arguments merge! is 166% slower See https://github.com/rails/rails/pull/32337 for more conversation
* | Fix docs of `assert_no_emails` [ci skip]bogdanvlviv2018-06-291-1/+1
| | | | | | | | `assert_no_emails` is shortcut for `assert_emails 0, &block`.
* | Allow call `assert_enqueued_with` and `assert_enqueued_email_with` with no blockbogdanvlviv2018-06-292-2/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Example of `assert_enqueued_with` with no block ```ruby def test_assert_enqueued_with MyJob.perform_later(1,2,3) assert_enqueued_with(job: MyJob, args: [1,2,3], queue: 'low') MyJob.set(wait_until: Date.tomorrow.noon).perform_later assert_enqueued_with(job: MyJob, at: Date.tomorrow.noon) end ``` Example of `assert_enqueued_email_with` with no block: ```ruby def test_email ContactMailer.welcome.deliver_later assert_enqueued_email_with ContactMailer, :welcome end def test_email_with_arguments ContactMailer.welcome("Hello", "Goodbye").deliver_later assert_enqueued_email_with ContactMailer, :welcome, args: ["Hello", "Goodbye"] end ``` Related to #33243
* | ActionMailer::Base can unregister observer(s) and interceptor(s). (#32207)Kota Miyake2018-05-304-19/+135
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * ActionMailer::Base can unregister observer(s) and interceptor(s). One or multiple mail observers can be unregistered using `ActionMailer::Base.unregister_observers` or `ActionMailer::Base.unregister_observer`. 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`. * Ensure to be reset registered observer(s) and interceptor(s) * Add explanation to CHANGELOG * Add original author's name [Kota Miyake + Rafael Mendonça França + Claudio Ortolina]
* | Eager autoload mail gem when eager load is true (#32808)Samuel Cochran2018-05-232-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Eager autoload mail gem when eager load is true We had a production issue where our Sidekiq worker threads all became deadlocked while autoloading a file within the mail gem, required via ActionMailer, despite setting our Rails applicaiton to eager load. `Mail.eager_autoload!` exists and works great, ActionMailer just doesn't call it during eager loading. Adding it to the ActionMailer Railtie's eager_load_namespaces takes care of calling `Mail.eager_autoload!` during the `eager_load!` initializer. * 'Mail' isn't defined yet, use before_eager_load instead * Make sure mail is loaded * Move eager load of Mail into ActionMailer.eager_load! [Samuel Cochran + Rafael Mendonça França]
* | Strip duplicated suffixes more strictlyRyuta Kamizono2018-04-221-1/+1
| | | | | | | | In the previous code incorrectly removes intermediate words.
* | Replace `assert !` with `assert_not`Daniel Colson2018-04-191-4/+4
| | | | | | | | | | This autocorrects the violations after adding a custom cop in 3305c78dcd.
* | Merge pull request #32427 from tjschuck/small_doc_fixesRyuta Kamizono2018-04-031-1/+1
|\ \ | | | | | | | | | | | | Small doc fixes [ci skip]
| * | Small doc fixesT.J. Schuck2018-04-021-1/+1
| | | | | | | | | | | | [ci skip]
* | | Doc fix added missing quoteMichael H2018-04-021-1/+1
|/ /
* | Partly revert #32231bogdanvlviv2018-03-141-4/+2
| | | | | | | | | | | | | | - Remove extra execution of `perform_enqueued_jobs` since it performs all enqueued jobs in the duration of the block. - Fix example of using `assert_emails` without block since we can't use enqueued jobs in this case.
* | Merge pull request #32231 from gmcgibbon/perform_email_jobs_in_assert_emailsRafael Mendonça França2018-03-133-6/+32
|\ \ | | | | | | | | | Perform email jobs in #assert_emails
| * | Perform email jobs in #assert_emailsGannon McGibbon2018-03-122-5/+29
|/ / | | | | | | Perform enqueued delivery jobs in #assert_emails and #assert_no_emails.
* | Rails 6 requires Ruby 2.4.1+Jeremy Daer2018-02-172-1/+6
| | | | | | | | | | | | Skipping over 2.4.0 to sidestep the `"symbol_from_string".to_sym.dup` bug. References #32028
* | Remove support to Ruby 2.2Rafael Mendonça França2018-02-161-1/+1
| | | | | | | | Rails 6 will only support Ruby >= 2.3.
* | Start Rails 6.0 development!!!Rafael Mendonça França2018-01-302-34/+4
| | | | | | | | :tada::tada::tada:
* | Use assert_empty and assert_not_emptyDaniel Colson2018-01-251-1/+1
| |
* | Use assert_predicate and assert_not_predicateDaniel Colson2018-01-251-2/+2
| |
* | Use respond_to test helpersDaniel Colson2018-01-251-2/+2
| |
* | Merge pull request #30391 from jbourassa/fix-actionmailer-lambda-defaultRyuta Kamizono2018-01-244-2/+34
|\ \ | | | | | | | | | Fix actionmailer lambda default
| * | Fix AM::Base.default proc arity breaking changeJimmy Bourassa2017-08-294-2/+33
| | | | | | | | | | | | | | | | | | | | | PR #29270 changed the number of arguments that gets passed to Procs defined in ActionMail::Base.default. With this changeset, Procs can now have 1 or 0 arguments Also adds test coverage for AM::Base.default Proc arity.
* | | Fix typos, update documentationJames Lovejoy2018-01-111-1/+1
| | | | | | | | | | | | [ci skip]
* | | Move the options for deliver_later up near to the example [ci skip]Prathamesh Sonpatki2018-01-041-12/+12
| | | | | | | | | | | | | | | | | | - And move the Active Job related section down. Otherwise it was appearing as if the options are available for the `delivery_job` setting.
* | | Bump license years for 2018Yoshiyuki Hirano2017-12-312-2/+2
| | |
* | | Enable `Layout/SpaceBeforeComma` rubocop rule, and fixed moreRyuta Kamizono2017-12-122-2/+2
| | | | | | | | | | | | Follow up of #31390.
* | | Preparing for 5.2.0.beta2 releaseRafael Mendonça França2017-11-282-1/+6
| | |
* | | Fix typos and add a few suggestionsFatos Morina2017-11-281-2/+2
| | |
* | | Preparing for 5.2.0.beta1 releaseRafael Mendonça França2017-11-272-1/+3
| | |
* | | Sort mailer previewsDwight Watson2017-11-141-1/+1
| | |