| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|\
| |
| |
| | |
ActionMailer: support overriding template name in multipart
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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).
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]
|
| | |
|
|\ \
| | |
| | |
| | | |
Fix actionmailer lambda default
|
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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.
|
|/ /
| |
| |
| |
| | |
Reverts 4d96be1c27bd6faed957b197a461f18543acebf2
References #31026
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
- 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]
|
|\ \ |
|
| | | |
|
|\| | |
|
| | |
| | |
| | |
| | |
| | | |
This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing
changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
|
| |\ \
| | | |
| | | |
| | | | |
Enforce frozen string in Rubocop
|
| | | | |
|
| |/ / |
|
|/ /
| |
| |
| |
| | |
This will avoid to the test fail when running in isolation because the
message generated is nil.
|
| | |
|
| | |
|
|\ \
| | |
| | |
| | | |
Allow to custom content type when setting mailer body
|
| | | |
|
| | | |
|
|/ / |
|
| |
| |
| |
| |
| |
| |
| |
| | |
Style/SpaceBeforeBlockBraces
Style/SpaceInsideBlockBraces
Style/SpaceInsideHashLiteralBraces
Fix all violations in the repository.
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
| | |
|
| | |
|
|/
|
|
|
| |
The current code base is not uniform. After some discussion,
we have chosen to go with double quotes by default.
|
|
|
|
|
|
|
|
|
| |
cloud8421/actionmailer-unregister-interceptor"
This reverts commit 65a61ab7c370d2894c11ce276725f723a5c9c111, reversing
changes made to 14314ca18302f18c3d8bb7a63e9f71ac4c2290c2.
This PR broke the build
|
|\
| |
| |
| | |
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.
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| | |
Example
````ruby
mail(hash) do |format|
format.any
end
````
|
| | |
|
| |
| |
| |
| | |
onwards.
|
|/
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
| |
Include appropriate helpers and use `assert_dom_equal` where applicable
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
`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.
|