`Minitest.plugin_rails_init` sets `Minitest.backtrace_filter` to
`Rails.backtrace_cleaner` right before tests are run, overwriting the
value set in test_helper.rb.
`Rails.backtrace_cleaner` silences backtrace lines that do not start
with `Rails.root` followed by e.g. "lib/" or "test/". Thus when
`Rails.root` is a subdirectory of the project directory -- for example,
when testing a plugin that has a dummy app -- all lines of the backtrace
are silenced.
This commit adds a fallback such that when all backtrace lines are
silenced, the original `Minitest.backtrace_filter` is used instead.
Additionally, this commit refactors and expands existing test coverage.
Permit applications to hack in custom DB config for ActionMailbox::InboundEmail until Action Mailbox has first-class multi-DB support:
ActiveSupport.on_load(:action_mailbox_record) do
connects_to reading: :action_mailbox_replica, writing: :action_mailbox_primary
end
Sendgrid, like Mailgun, only passes BCC recipients as a parameter in the original JSON payload.
This PR adds code to prepend the recipients from the Sendgrid payload to the raw_email under the X-Original-To header.
References #38738.
Generators generate things, but what is meant by 'Stubbing out' might
confuse beginners and non-native English speakers.
While generated tests are stubs that should have an implementation, a
generated model is a valid model that doesn't require any changes.
- Add the configuration option for annotating templates with file names to the generated app.
- Add `annotate_rendered_view_with_filenames` option to configuring guide.
Mandrill's Inbound API checks to see if a URL exists before it creates
the webhook. It sends a HEAD request, to which we now return a 200 OK
response to indicate that the route exists.
Now we can generate inbound API calls with ease on Mandrill, without
having to shuffle around tokens in production.
Fixes#37609.
* Add a way to deliver inbound emails by source
Great for testing when you get an eml file and can just paste it in.
* Test updates
* Fix tests
* Fix spacing
As a developer, when looking at a page in my web browser, it's sometimes
difficult to figure out which template(s) are being used to render the page.
config.action_view.annotate_template_file_names adds HTML comments to the
rendered output indicating where each template begins and ends.
Co-authored-by: Aaron Patterson <tenderlove@github.com>
* require, require_relative, load by double quotes
We're getting rid of all single quote usage, unless it serves a specific purpose, as per the general style guide.
Expose the Mailgun SMTP recipient to Action Mailbox as X-Original-To, like Postfix.
Allows handling BCCed recipients who aren't listed in To/CC fields.
Forward ActionMailbox install to install generator and hide the ActionMailbox install generator from generator list
Updated the Action Mailbox install task description
The from_address method is added to Mail::Message, but is not used
internally to ActionMailbox, nor tested (even implicitly). As it is part
of the public API, it feels important to at least have a basic test of
it.
Similarly, the x_original_to_addresses was only implicitly tested via
the recipients_addresses method. Given other similar methods are
explicitly tested, it feels like an oversight not to test it as well.
As the test introduced from_address didn't align with the naming of
RecipientsTest, I renamed it to the more generic AddressesTest.
Rails 6.0 introduces parallel testing and the default degree of parallelism is configured based on the number of CPU.
refer https://github.com/rails/rails/pull/34735https://github.com/rails/rails/pull/31900
When any minitest executed under the OS where 2 or more CPU available,
SQLite 3 database files are not git-ignored.
Also updated other files which ignores SQLite database files.
* Steps to reproduce
```
$ git clone https://github.com/yahonda/rep_ignore_sqlite3_databases.git
$ cd rep_ignore_sqlite3_databases/
$ bin/rails test
$ git status
```
* Expected behavior:
- No `Untracked files:`
* Actual behavior:
- SQLite 3 database files appeared
```
$ git status
On branch master
Untracked files:
(use "git add <file>..." to include in what will be committed)
db/test.sqlite3-0
db/test.sqlite3-1
db/test.sqlite3-2
db/test.sqlite3-3
db/test.sqlite3-4
db/test.sqlite3-5
nothing added to commit but untracked files present (use "git add" to track)
$
```
Allow passing a block to the create_inbound_email_from_mail and
receive_inbound_email_from_mail test helper methods.
When you wanted to test a multipart email -- for example, an email that
has both a plaintext part and an HTML part -- there wasn't a way to
easily build one without a pre-made fixture. By allowing you to pass a
block to these methods, we unlock the power of Mail.new to easily
create a variety of emails, from multi-part emails, to emails with
attachments, and beyond.