Commit Graph

1773 Commits

Author SHA1 Message Date
Sam Ruby
0350187882 Fix mailer templates to be rubocop compliant
- spaces around array elements
- only emit blank lines between new blocks of code
2024-06-23 07:28:25 -04:00
Rafael Mendonça França
7ee34d9efb
Enable Rails minitest plugin in our rake tasks 2024-05-23 16:16:37 +00:00
Rafael Mendonça França
bf59d363fb
Clean CHANGELOG for 8.0 2024-05-13 16:55:52 +00:00
Rafael Mendonça França
37fd0e7fe4
Development of Rails 8.0 starts now
🎉
2024-05-13 16:45:20 +00:00
fatkodima
041de49399 Remove usage of OpenStruct 2024-04-09 21:35:08 +03:00
eileencodes
50515fb45f
Add more ostruct requires
`ostruct` was being implictly required by the `json` gem. But once it
was upgraded, these tests failed to initialize `OpenStruct`.

While we're trying to remove `ostruct` usage in #51510, CI is currently
failing so I'm pushing these in the mean time.
2024-04-09 11:34:44 -04:00
Rafael Mendonça França
154f7c2181
Register autoload for ActiveJob::Arguments
Since #50715, there are cases where `ActiveJob::Arguments` is used
but not required anymore in the test environment. This could be a
test for a custom argument serializer.

One solution could be to add a require "active_job/arguments" in
all the usages, but that isn't a convention we follow in Rails.

Instead, let's register the autoload for `ActiveJob::Arguments` in
`active_job.rb` so that it's always available when needed.
2024-02-13 20:34:10 +00:00
Petrik
8565f45100 Use relative includes of README's in documentation [ci-skip]
The Rails documentation uses the `:include:` directive to inline the
README of the framework into the main documentation page. As the
README's aren't in the root directory from where SDoc is run we need to
add the framework path to the include:

    # :include: activesupport/README.md

This results in a warning when installing the gems as generating the rdoc for the gem is run from the gem/framework root:

    Couldn't find file to include 'activesupport/README.rdoc' from lib/active_support.rb

The `:include:` RDoc directive supports includes relative to the current
file as well:

    # :include: ../README.md

This makes sure it works for the Rails API docs and the separate gems.

Co-authored-by: Jonathan Hefner <jonathan@hefner.pro>
2024-01-18 10:39:15 +01:00
Jean Boussier
946e46ebcc Modernize method missing implementations
`...` is both simpler an more correct since the keyword argument
separation.
2024-01-16 13:17:45 +01:00
Rafael Mendonça França
b1479e412d
Remove redundant version constraint on mail gem 2024-01-09 19:41:52 +00:00
Earlopain
45f64f5a0a
Remove workaround for mail gem dependencies
d9d8dcc6ba
https://github.com/rails/rails/pull/44083

Remove backwards compat workaround for versions earlier than 2.8.0
2024-01-09 13:25:36 +01:00
Jean Boussier
ef65e5fb32 Cleanup usage of ruby2_keywords
Now that we no longer support Ruby 2.7, many `ruby2_keyword` calls
can be eliminated.

The ones that are left could be eliminated but would end up substantially
slower or more compliacated so I left them for now.
2024-01-05 14:40:18 +01:00
Jean Boussier
6ba2fdb2fe Bump the required Ruby version to 3.1.0
Until now, Rails only droped compatibility with older
rubies on new majors, but I propose to change this policy
because it causes us to either keep compatibility with long
EOLed rubies or to bump the Rails major more often, and to
drop multiple Ruby versions at once when we bump the major.

In my opinion it's a bad alignments of incentives. And we'd
be much better to just drop support in new minors whenever they
go EOL (so 3 years).

Also Ruby being an upstream dependency, it's not even
a semver violation AFAICT.

Since Rails 7.2 isn't planned before a few months, we
can already drop Ruby 3.0 as it will be EOL in March.
2023-12-31 08:54:03 +01:00
Rafael Mendonça França
992a126c6e
Remove deprecated params via :args for assert_enqueued_email_with 2023-11-22 22:11:32 +00:00
Rafael Mendonça França
2bd6cf5177
Remove deprecated config.action_mailer.preview_path 2023-11-22 22:11:31 +00:00
Xavier Noria
37833debc6 Remove obsolete workaround in Action Mailer
The buggy interaction between config.paths and config.autoload_paths
described in the comment was fixed in 7.1.2.
2023-11-21 21:30:30 +01:00
Thiago Pradi
3673aea825 removing old and not used actionmailer fixtures 2023-11-19 23:25:40 -03:00
Jonathan Hefner
99ddec8d2d Use h2 headings for ActionMailer::Base [ci-skip]
For SEO purposes, there should only be one `<h1>` per page.
2023-10-26 17:37:32 -05:00
Jean Boussier
02e679ba75 Get rid of the jruby_skip test helper
The last test calling it actually passes on latest
JRuby.
2023-10-02 13:01:44 +02:00
Bart de Water
95b6fbd00f Stop building AS::Notifications::Event manually
It's possible since Rails 6 (3ea2857943dc294d7809930b4cc5b318b9c39577) to let the framework create Event objects, but the guides and docs weren't updated to lead with this example.

Manually instantiating an Event doesn't record CPU time and allocations, I've seen it more than once that people copy-pasting the example code get confused about these stats returning 0. The tests here show that - just like the apps I've worked on - the old pattern keeps getting copy-pasted.
2023-09-29 12:34:23 -04:00
Rafael Mendonça França
fb6c6007d0
Development of Rails 7.2 starts now
🎉
2023-09-27 03:59:11 +00:00
Rafael Mendonça França
e5386cb402
Preparing for 7.1.0.rc1 release 2023-09-27 03:08:31 +00:00
Rafael Mendonça França
e7009b14b6
Remove unused mailer 2023-09-27 02:45:56 +00:00
Christoph Geschwind
647e39b278
Log delivery errors in ActionMailer::LogSubscriber
In case of mail delivery errors, the old ActionMailer::LogSubscriber
erroneously logged a "Delivered mail ..." line.
With this change it checks the passed exception object and logs a
"Failed delivery of mail" line instead.

Co-authored-by: Christian Esser <c_esser@yahoo.de>
2023-09-27 02:45:55 +00:00
Alex Ghiculescu
9a2cf33f21
Introduce ActionMailer::FormBuilder
Fixes https://github.com/rails/rails/issues/48477

Using forms inside emails is not common, but it's possible, and it's also possible to share views between controllers and mailers. Currently if a controller sets a `default_form_builder` that's different from the global config, mailers that use the same views will not default to the same `FormBuilder`. To fix this, this PR adds a `default_form_builder` method for mailers that does the same thing as its controller sibling.
2023-09-25 20:33:22 +00:00
Shouichi Kamiya
51ac8b9f6f Enable Minitest/LiteralAsActualArgument
There are assertions that expected/actual arguments are passed in the
reversed order by mistake. Enabling the LiteralAsActualArgument rule
prevents this mistake from happening.

The existing tests were auto-corrected by rubocop with a bit of
indentation adjustment.

Co-authored-by: Jonathan Hefner <jonathan@hefner.pro>
2023-09-13 10:09:32 +09:00
Rafael Mendonça França
699dfdb426
Preparing for 7.1.0.beta1 release 2023-09-13 00:36:01 +00:00
Petrik
6998747947 Remove internal usage of require_dependency
Since 6983a89c726243fb38fe28cff49cba3a5f63ba6f `require_dependency` is
obsolete  since Rails stopped supporting classic mode.
It is only used by engines that need to support classic mode as well.

We can safely remove internal usage of `require_dependency`.

It was only used in the ActionMailer::Preview which is using just
`require` anyway.
2023-09-05 16:05:48 +02:00
Xavier Noria
b16adcd4e4 Generate config.autoload_lib(...) for new apps 2023-08-25 09:22:25 +02:00
Martin Spickermann
dd8b0e4684 Sort mailers on mailer preview page alphabetically 2023-08-21 11:11:25 +02:00
Mike Dalessio
8a57ba8c0e
Update Action View and Dispatch to use Rails::Dom::Testing helpers
Use the helpers introduced in rails-dom-testing 2.2.0 instead of
managing the HTML parsers as was done in #48523.

See also related #47144 / ad79ed0e
2023-08-03 11:17:38 -04:00
Alex Ghiculescu
455e922b49
Introduce capture_emails and capture_broadcasts (#48798) 2023-07-25 06:42:54 +02:00
Alex Ghiculescu
ba70a5be86 Make perform_enqueued_jobs compatible with all Active Job adapters 2023-06-28 20:08:08 +10:00
zzak
dd89f600f7
🔗 Remove RDoc auto-link from Rails module everywhere 2023-06-23 10:49:30 +09:00
zzak
2cdb05f7e1
Make ActionMailer::TestCase#read_fixture public
Since this method has been documented in the guides for ages, it's probably safe.

https://guides.rubyonrails.org/testing.html#revenge-of-the-fixtures

TODO: I don't like how these methods are documented on
ActionMailer::TestCase::Behavior, even though the API is meant to be
exposed through ActionMailer::TestCase
2023-06-20 15:44:52 +09:00
zzak
722d4f6582
Unlink Rails constant from READMEs 2023-05-29 15:14:44 +09:00
zzak
38bef29064
Replace all occurrences of '<tt>(\w+::\w+::\w+)</tt>' with '+$1+'
E.g.:

* <tt>Rails::Command::NotesCommand</tt> -> +Rails::Command::NotesCommand+

Co-authored-by: Hartley McGuire <skipkayhil@gmail.com>
2023-05-25 06:56:17 +09:00
zzak
e3c73fd183
Replace all occurrences of '<tt>(\w+::\w+)</tt>' with '+$1+'
E.g.:

* <tt>ActiveRecord::Base</tt> -> +ActiveRecord::Base+

Co-authored-by: Hartley McGuire <skipkayhil@gmail.com>
Co-authored-by: Petrik de Heus <petrik@deheus.net>
2023-05-25 06:52:32 +09:00
Shivam Chahar
f30fc95c75 Remove redundant test 2023-05-22 19:31:46 +05:30
Jonathan Hefner
fc9470aa97
Merge pull request #48194 from jonathanhefner/assert_enqueued_email_with-deprecate-params-via-args
Deprecate params via `:args` for `assert_enqueued_email_with`
2023-05-19 17:26:50 -05:00
Hartley McGuire
d028c14b03
Link rescue_from from modules including Rescuable
Also add some additional words to make it clear that the modules also
implement handling the exceptions configured with rescue_from, because
it was not immediately clear that happened without reading the code.
2023-05-18 12:54:16 -04:00
Jonathan Hefner
19df946585 Deprecate params via :args for assert_enqueued_email_with
In #45752, a `:params` kwarg was added to `assert_enqueued_email_with`
so that mailer params and args could be specified simultaneously.
However, for backward compatibility, the old behavior of treating an
`:args` Hash as params was preserved.  The result is that if both
`:params` and `:args` are specified and `:args` is a Hash, `:params` is
ignored.

This commit deprecates specifying params via `:args` (i.e. passing a
Hash to `:args`).

After the deprecated behavior is removed, it will be possible to pass
a Hash to `:args`, and the Hash will be treated as named args instead.
2023-05-11 14:11:17 -05:00
Max Chernyak
96f19e965b Add matcher support to assert_enqueued_email_with
Support args/params proc matchers in `assert_enqueued_email_with` to
make it behave more like `assert_enqueued_with`.

Fix #46621.

Co-authored-by: Jonathan Hefner <jonathan@hefner.pro>
2023-05-11 11:43:54 -05:00
Jean Boussier
06d2c2d15b Refactor ActionView::Template::Types to avoid delegation
The `Type` class was introduced in https://github.com/rails/rails/pull/23085
for the sole purpose of breaking the dependency of Action View on Action Dispatch.

Unless you are somehow running Action View standalone, this is actually
never used.

So instead of delegating, we can use constant swapping, this saves us
a useless layer.

Ultimately we could consider moving `Mime::Types` into Active Support
but it requires some more thoughts.
2023-05-08 10:34:46 +09:00
Shivam Chahar
88f9bc1237 Remove noise from actionmailer callbacks test 2023-04-26 21:38:54 +05:30
John Hawthorn
6cd8dddb92
Merge pull request #47630 from bensheldon/action_mailer_around_delivery
Add `*_deliver` callbacks for Action Mailer
2023-04-04 14:58:15 -07:00
Petrik
c09f5fa956 Add missing headers to Action Mailbox/Mailer/Text/View docs [ci-skip]
Having a h1 heading will improve SEO and makes things look more consistent.
2023-04-02 17:47:17 +02:00
Rafael Mendonça França
055572ec36
Correct documentation of assert_emails 2023-03-31 21:24:10 +00:00
Ben Sheldon
468d806406 Add *_deliver callbacks for Action Mailer 2023-03-29 17:12:19 -07:00
Petrik
7c94708d24 Include READMEs in main framework pages of the API documentation
Currently when opening the main framework pages there is no introduction
to the framework. Instead we only see a whole lot of modules and the
`gem_version` and `version` methods.

By including the READMEs using the `:include:` directive each frameworks
has a nice introduction.
For markdown READMEs we need to add the :markup: directive.

[ci-skip]

Co-authored-by: zzak <zzakscott@gmail.com>
2023-03-21 21:16:28 +01:00