aboutsummaryrefslogtreecommitdiffstats
path: root/actionmailer/test/base_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* 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-131-1/+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.
* Add test and change how format set in ActionMailerJohn Hawthorn2019-03-011-0/+10
| | | | | | | | | | 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.
* 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-131-0/+17
| | | | | | 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.
* 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
|
* Merge pull request #22534 from evopark/masterRafael Mendonça França2018-11-191-0/+6
|\ | | | | | | ActionMailer: support overriding template name in multipart
| * ActionMailer: support overriding template name in multipartMarcus Ilgner2015-12-081-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | 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.
* | 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 ```
* | 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]
* | Use respond_to test helpersDaniel Colson2018-01-251-2/+2
| |
* | Merge pull request #30391 from jbourassa/fix-actionmailer-lambda-defaultRyuta Kamizono2018-01-241-0/+9
|\ \ | | | | | | | | | Fix actionmailer lambda default
| * | Fix AM::Base.default proc arity breaking changeJimmy Bourassa2017-08-291-0/+9
| | | | | | | | | | | | | | | | | | | | | 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 tests on Mail 2.7Jeremy Daer2017-10-311-16/+15
|/ / | | | | | | | | Reverts 4d96be1c27bd6faed957b197a461f18543acebf2 References #31026
* | Do not generate default alt text in image tagsCameron Cundiff2017-08-171-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Auto-generating content from the filename of an image is not suitable alternative text; alt text that isn't fully considered can be distracting and fatiguing for screen readers users (blind, low vision, dyslexic people). - Setting a filename fallback short circuits screen reader default behavior and configuration for blank descriptions. - Setting poor defaults also creates false negatives for accessibility linting and testing software, that makes it harder to improve application accessibility. *** - After this change, if authors leave images without alt text, screen readers will fallback to default behavior for missing alt text. - Also with this change, Automated linting and testing tools will correctly generate warnings. [Fixes #30096]
* | Merge remote-tracking branch 'origin/master' into unlock-minitestRafael Mendonça França2017-08-011-0/+2
|\ \
| * | Use frozen string literal in actionmailer/Kir Shatrov2017-07-231-0/+2
| | |
* | | Merge branch 'master' into unlock-minitestKasper Timm Hansen2017-07-151-2/+2
|\| |
| * | Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"Matthew Draper2017-07-021-1/+0
| | | | | | | | | | | | | | | This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
| * | Merge pull request #29540 from kirs/rubocop-frozen-stringMatthew Draper2017-07-021-0/+1
| |\ \ | | | | | | | | | | | | Enforce frozen string in Rubocop
| | * | Enforce frozen string in RubocopKir Shatrov2017-07-011-0/+1
| | | |
| * | | Make ActionMailer frozen string literal friendly.Pat Allan2017-06-201-2/+2
| |/ /
* / / Avoid stubing on this testRafael Mendonça França2017-04-271-3/+2
|/ / | | | | | | | | This will avoid to the test fail when running in isolation because the message generated is nil.
* | Pass request params to ActionMailer::PreviewAlexey Zapparov2017-03-011-0/+16
| |
* | Add `:args` to `process.action_mailer` eventyuuji.yaginuma2017-02-041-0/+19
| |
* | Merge pull request #27227 from MQuy/allow-custom-content-type-in-mail-bodyRafael Mendonça França2017-01-061-0/+5
|\ \ | | | | | | | | | Allow to custom content type when setting mailer body
| * | Fix wrong typo in testMQuy2016-12-051-1/+1
| | |
| * | allow context type when set body mailMQuy2016-11-301-0/+5
| | |
* | | 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
|