aboutsummaryrefslogtreecommitdiffstats
path: root/actionmailer/test
Commit message (Collapse)AuthorAgeFilesLines
* Revert "MethodCallAssertions is a regular player of the team ↵Rafael Mendonça França2019-08-021-0/+3
| | | | | | ActiveSupport::TestCase now" This reverts commit 98d0f7ebd34b858f12a12dcf37ae54fdbb5cab64.
* Revert "You give jruby_skip & rubinius_skip a good name"Rafael Mendonça França2019-08-021-0/+13
| | | | This reverts commit 8d2866bb80fbe81acb04f5b0c44f152f571fb29f.
* You give jruby_skip & rubinius_skip a good nameAkira Matsuda2019-08-021-13/+0
| | | | | | | | This hack prevails everywhere in the codebase by being copy & pasted, and it's actually not a negative thing but a necessary thing for framework implementors, so it should better have a name and be a thing. And with this commit, activesupport/test/abstract_unit.rb now doesn't silently autoload AS::TestCase, so we're ready to establish clearner environment for running AS tests (probably in later commits)
* MethodCallAssertions is a regular player of the team ActiveSupport::TestCase nowAkira Matsuda2019-08-021-3/+0
| | | | It's used everywhere, clean and mature enough
* Do not use the same test class in different testsyuuji.yaginuma2019-08-011-2/+2
| | | | | | | | | This fixes the following warnings. ``` actionmailer/test/base_test.rb:272: warning: method redefined; discarding old welcome actionmailer/test/base_test.rb:260: warning: previous definition of welcome was here ```
* Merge pull request #36227 from ↵Rafael França2019-07-261-0/+11
|\ | | | | | | | | betesh/avoid-misleading-error-about-late-attachments Prevent reading inline attachments after `mail` was called from raising an inaccurate exception
| * Prevent reading inline attachments after `mail` was called from raising an ↵Isaac Betesh2019-05-211-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | inaccurate exception Without this change, `attachments.inline['my_attachment'].present?`, for example, would raise the exception `Can't add attachments after mail was called`. I first brought this issue up at https://github.com/rails/rails/issues/16163#issuecomment-437378347. Note that this commit addresses only one of the 2 problems I described in that comment. The other problem is that using `attachments.inline['my_attachment']` for reading an attachment is unnecessary--it's the same as `attachments['my_attachment']`--even before `mail` is called. We could add a warning about the unnecessary use of `inline` but I'm saving that for a later PR since my comment has not received any feedback yet.
* | Enable `Layout/EmptyLinesAroundAccessModifier` copRyuta Kamizono2019-06-137-7/+0
|/ | | | | | | | | | | We sometimes say "✂️ newline after `private`" in a code review (e.g. https://github.com/rails/rails/pull/18546#discussion_r23188776, https://github.com/rails/rails/pull/34832#discussion_r244847195). Now `Layout/EmptyLinesAroundAccessModifier` cop have new enforced style `EnforcedStyle: only_before` (https://github.com/rubocop-hq/rubocop/pull/7059). That cop and enforced style will reduce the our code review cost.
* Output junit format test reportFumiaki MATSUSHIMA2019-04-041-0/+2
|
* Add test and change how format set in ActionMailerJohn Hawthorn2019-03-014-0/+16
| | | | | | | | | | Previously this used self.formats= to set the format which render would use to find templates. This worked, but was untested, and looked a little confusing because it was doing the mutation within a loop. This commit replaces the assignment with passing formats: [format] into the render call, which makes it more obvious that that's the purpose of the format. It also adds a test to verify the formats being used.
* Merge pull request #35293 from rails/remove-rendered-format-from-cacheAaron Patterson2019-02-191-5/+5
|\ | | | | Pass the template format to the digestor
| * pass format to the digestorAaron Patterson2019-02-161-5/+5
| |
* | Auto correct rubocop offensesYoshiyuki Hirano2019-02-171-12/+10
|/ | | | | | | | | | | | | | | | | | Offenses: railties/lib/rails/autoloaders.rb:1:1: C: [Corrected] Style/FrozenStringLiteralComment: Missing magic comment # frozen_string_literal: true. module Rails ^ actionmailer/test/base_test.rb:917:1: C: [Corrected] Layout/EmptyLinesAroundBlockBody: Extra empty line detected at block body beginning. actionmailer/test/base_test.rb:917:1: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected. actionmailer/test/base_test.rb:917:5: C: [Corrected] Style/RedundantBegin: Redundant begin block detected. begin ^^^^^ actionmailer/test/base_test.rb:918:3: C: [Corrected] Layout/IndentationWidth: Use 2 (not 4) spaces for indentation. events = [] ^^^^ actionmailer/test/base_test.rb:930:1: C: [Corrected] Layout/EmptyLinesAroundBlockBody: Extra empty line detected at block body end. actionmailer/test/base_test.rb:930:1: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
* Don’t log recipients when sending mailJaap van der Plas2019-02-133-6/+23
| | | | | | Since production applications typically run with log level info and email adresses should be considered as sensitive data we want to prevent them from ending up in the logs. In development mode (with log level debug) they are still logged as part of the Mail::Message object.
* Fix legacy fallback for parameterized mailersGannon McGibbon2019-01-072-5/+4
|
* Remove mention about `receive.action_mailer` from the AS instrumentation guidebogdanvlviv2018-12-281-3/+4
| | | | | Since e3f832a7433a291a51c5df397dc3dd654c1858cb `ActionMailer::Base.receive` is deprecated.
* Deprecate ActionMailer::Base.receive in favor of Action MailboxGeorge Claghorn2018-12-271-2/+3
|
* Enable `Style/RedundantBegin` cop to avoid newly adding redundant begin blockRyuta Kamizono2018-12-211-14/+12
| | | | | | | | | | Currently we sometimes find a redundant begin block in code review (e.g. https://github.com/rails/rails/pull/33604#discussion_r209784205). I'd like to enable `Style/RedundantBegin` cop to avoid that, since rescue/else/ensure are allowed inside do/end blocks in Ruby 2.5 (https://bugs.ruby-lang.org/issues/12906), so we'd probably meets with that situation than before.
* fix tests for mail 2.8pavel2018-12-191-4/+4
|
* Add MailDeliveryJob for unified mail deliveryGannon McGibbon2018-12-044-13/+101
| | | | | Add `MailDeliveryJob` for delivering both regular and parameterized mail. Deprecate using `DeliveryJob` and `Parameterized::DeliveryJob`.
* Add yield to with_delivery_job test helperGannon McGibbon2018-11-301-0/+1
| | | | | Adds yield to parameterized mail test helper so assertions passed into with_delivery_job are actually ran.
* Deliver parameterized mail with DeliveryJobGannon McGibbon2018-11-223-20/+36
| | | | | Deliver parameterized mail with `ActionMailer::DeliveryJob` and remove `ActionMailer::Parameterized::DeliveryJob`.
* Fix ActionMailer assertion not working for mail defining delivery_job:Edouard CHIN2018-11-211-0/+51
| | | | | | | | | | | | | | | | | | | - 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-192-0/+13
|\ | | | | | | ActionMailer: support overriding template name in multipart
| * ActionMailer: support overriding template name in multipartMarcus Ilgner2015-12-082-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | 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
* | 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-051-0/+13
| | | | | | | | | | | | | | | | | | | | 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
* | 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 `perform_deliveries` to a payload of `deliver.action_mailer` notification.Yoshiyuki Kinjo2018-09-091-3/+6
| |
* | Skip delivery notification when perform_deliveries is false.Yoshiyuki Kinjo2018-09-082-0/+16
| |
* | Fix the obvious typos detected by github.com/client9/misspellKazuhiro Sera2018-08-081-1/+1
| |
* | Allow call `assert_enqueued_with` and `assert_enqueued_email_with` with no blockbogdanvlviv2018-06-291-2/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-301-14/+81
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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]
* | Replace `assert !` with `assert_not`Daniel Colson2018-04-191-4/+4
| | | | | | | | | | This autocorrects the violations after adding a custom cop in 3305c78dcd.
* | Perform email jobs in #assert_emailsGannon McGibbon2018-03-121-0/+22
| | | | | | | | Perform enqueued delivery jobs in #assert_emails and #assert_no_emails.
* | 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-242-1/+17
|\ \ | | | | | | | | | Fix actionmailer lambda default
| * | Fix AM::Base.default proc arity breaking changeJimmy Bourassa2017-08-292-1/+17
| | | | | | | | | | | | | | | | | | | | | 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.
* | | Enable `Layout/SpaceBeforeComma` rubocop rule, and fixed moreRyuta Kamizono2017-12-122-2/+2
| | | | | | | | | | | | Follow up of #31390.
* | | Fix tests on Mail 2.7Jeremy Daer2017-10-312-17/+16
| | | | | | | | | | | | | | | Reverts 4d96be1c27bd6faed957b197a461f18543acebf2 References #31026
* | | Merge pull request #31004 from shuheiktgw/remove_unnecessary_returnsRafael França2017-10-311-1/+1
|\ \ \ | | | | | | | | Remove redundant return statements
| * | | removed unnecessary returnsShuhei Kitagawa2017-10-281-1/+1
| | | |
* | | | removed unnecessary semicolonsShuhei Kitagawa2017-10-281-6/+6
|/ / /