Commit Graph

57 Commits

Author SHA1 Message Date
Omri Gabay
43d83e96c9
Add option to mute multiple database yaml warning
Adds an option to silence the warning that database configurations can
throw when it's unparsable.
2020-10-29 16:57:57 -04:00
Jonathan Hefner
33fdae0584 Fix backtraces for generated plugin tests
`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.
2020-10-07 15:40:56 -05:00
bogdanvlviv
c15b5ab125
Eliminate fixture_file_upload related deprecation warnings in actionmailbox/test
https://buildkite.com/rails/rails/builds/71675#2b9c36e5-5504-4a8e-8c4d-af774e96ea16/954-982
https://buildkite.com/rails/rails/builds/71675#2b9c36e5-5504-4a8e-8c4d-af774e96ea16/954-988

```bash
.................DEPRECATION WARNING: Passing a path to `fixture_file_upload`
relative to `fixture_path` is deprecated.
In Rails 6.2, the path needs to be relative to `file_fixture_path`.

Please modify the call from
`fixture_file_upload("files/avatar1.jpeg")` to `fixture_file_upload("avatar1.jpeg")`.
DEPRECATION WARNING: Passing a path to `fixture_file_upload` relative to `fixture_path` is deprecated.
In Rails 6.2, the path needs to be relative to `file_fixture_path`.

Please modify the call from
`fixture_file_upload("files/avatar2.jpeg")` to `fixture_file_upload("avatar2.jpeg")`.
........................................................................
```

`fixture_file_upload` now uses path relative to `file_fixture_path`, see
https://github.com/rails/rails/pull/39086,
61c4be4777/actionmailbox/test/test_helper.rb (L21)
2020-09-21 16:14:20 +03:00
Akira Matsuda
47f5459138 Module#const_set is a public method 2020-09-15 17:19:37 +09:00
Mark Haussmann
71c8a89edd
Sendgrid: prepend X-Original-To header with envelope recipients
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.
2020-07-21 19:38:38 -04:00
fatkodima
6c4f3be929 Unify raise_on_missing_translations for views and controllers 2020-05-20 02:42:59 +03:00
Prathamesh Sonpatki
a673ce69e7
Rename annotate_template_file_names to annotate_rendered_view_with_filenames
- Add the configuration option for annotating templates with file names to the generated app.
- Add `annotate_rendered_view_with_filenames` option to configuring guide.
2020-05-19 09:28:14 +05:30
Bill Cromie
fce29be335 Add a route to handle Mandrill's webhook URL check
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.
2020-04-07 13:22:36 +01:00
Joel Hawksley
a59e1de26a .annotate_template_file_names annotates HTML output with template file names
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>
2020-03-30 14:50:01 -06:00
David Heinemeier Hansson
3e0cdbeaf4
require, require_relative, load by double quotes (#38841)
* 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.
2020-03-29 16:30:52 -07:00
Rikki Pitt
667d69cc5b
Add X-Original-To to mail using Mailgun recipient (#38738)
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.
2020-03-23 18:10:48 -07:00
Matthijs Vos
8dca5162f9
Replace Mailgun API key with signing key
Mailgun now needs the signing key instead of the API key for validating incoming mails.
2020-02-21 11:33:04 -05:00
aminamos
65cbbf2282 implemented review feedback and the original change from parent PR in app_base.rb 2020-02-12 13:31:43 -05:00
aminamos
7bb0706f2c update from PR #36222 2020-02-12 13:31:43 -05:00
Haroon Ahmed
db1ae8cbb4 remove reference to global rails command and replace with bin/rails 2019-12-27 19:32:37 +00:00
Rafael Mendonça França
9e70042081
Merge pull request #28499 from grosser/grosser/puma
unify puma types and remove blocks
2019-12-18 10:23:08 -03:00
Eileen M. Uchitelle
cad13033fc
Merge pull request #37847 from pwim/action-mailbox-mail-ext-tests
Test extensions to Mail gem
2019-12-12 10:15:07 -05:00
George Claghorn
7d0327bbbf Track Active Storage variants in the database 2019-12-06 13:26:51 -05:00
Paul McMahon
40d63cee31 Test extensions to Mail gem
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.
2019-12-03 06:51:41 +09:00
DmitryTsepelev
e7f798c3f5 Allow configure services for individual attachments 2019-10-01 21:24:05 +03:00
Abhay Nikam
76ed911a91 Correct the assertion argument order 2019-08-08 00:06:34 +05:30
George Claghorn
c2f197c775 Correct assertion argument order 2019-08-07 10:54:56 -04:00
Michael Herold
ab34ed8acc Allow testing multipart emails in Action Mailbox
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.
2019-08-07 10:12:13 -04:00
Akira Matsuda
0d981a2b3d Let the generated initializers/backtrace_silencers.rb code use Regexp#match? 2019-07-29 14:21:30 +09:00
John Duff
09e5d6d004 Fix Bcc header missing with emails from conductor and test helpers 2019-07-26 13:04:16 -04:00
George Claghorn
72bc0806a7 Correct assertion argument order 2019-07-25 22:34:40 -04:00
Kyle Keesling
ce88f6bd25
Fix filenames of attachments created via the inbound email conductor
controller passed along attachment file paths instead of their filenames
2019-07-25 21:11:29 -04:00
yuuji.yaginuma
74e38da810 Test against all sent attributes 2019-06-23 10:33:29 +09:00
yuuji.yaginuma
aab9f6734d Include BCC in the mail that sent from the development page
The BCC should be included as we show input field for BCC in view.
bf625f7fec/actionmailbox/app/views/rails/conductor/action_mailbox/inbound_emails/new.html.erb (L21-L24)
2019-06-20 14:09:01 +09:00
James Dabbs
80af2c5831 Rename variable to represent type
per comments from CR
2019-05-05 10:29:31 -07:00
James Dabbs
9f96d094a3 Expose mailbox_for method
Currently, the only exposed entry point into the ApplicationMailbox's configured
routing system is to call `route`, which performs a lot of work to fully
`process` inbound email. It'd be nice to have a way (e.g. in test) of checking
which mailbox an email would route to without necessarily processing it yet.
2019-05-04 10:53:08 -07:00
George Claghorn
f480cfabcd
Remove the Amazon SES ingress
It's unusable and not ready to ship in Rails 6.0. We'll rewrite it for 6.1.
2019-04-14 12:15:54 -04:00
Fumiaki MATSUSHIMA
61c4be4777 Output junit format test report 2019-04-04 14:34:46 +09:00
eileencodes
c932850ef2 Add secret token for action mailbox tests
We need to create a secret token in the application so that the travis
build doesn't error when trying to create a file in the tmp directory.

Fixes https://travis-ci.org/rails/rails/jobs/505908163#L6811
2019-03-13 16:35:24 -04:00
Ryuta Kamizono
b7fa01bb2f
Merge pull request #35529 from abhaynikam/35492-follow-up-to-updates-links-to-https
Updated links from http to https in guides, docs, etc
2019-03-09 20:49:27 +09:00
Abhay Nikam
476abd403b Updated links from http to https in guides, docs, etc 2019-03-09 16:43:47 +05:30
Sharang Dashputre
bf87dae202 Upgrade webpack-dev-server version in test apps 2019-03-09 03:35:22 +05:30
Sharang Dashputre
8eaffa1945 Use the latest stable release of webpacker 2019-03-09 00:14:17 +05:30
Ryuta Kamizono
da5843436b SQLite3: Implement add_foreign_key and remove_foreign_key
I implemented Foreign key create in `create_table` for SQLite3 at
#24743. This follows #24743 to implement `add_foreign_key` and
`remove_foreign_key`.
Unfortunately SQLite3 has one limitation that
`PRAGMA foreign_key_list(table-name)` doesn't have constraint name.
So we couldn't implement find/remove foreign key by name for now.

Fixes #35207.
Closes #31343.
2019-02-11 14:15:16 +09:00
Pratik
d0037daa37 Allow skipping incineration of processed emails 2019-02-06 19:28:49 -05:00
Ryuta Kamizono
b8baa15adb Revert "Apply t.timestamps changes in Action Text and Action Mailbox"
This reverts commit 30f666f87ab873258b797b39f29cf852f7621bea.
2019-01-29 06:37:42 +09:00
Ryuta Kamizono
30f666f87a Apply t.timestamps changes in Action Text and Action Mailbox
Follow up #34956.
2019-01-29 04:59:36 +09:00
Ryuta Kamizono
57015cdfa2 Make t.timestamps with precision by default 2019-01-26 22:49:14 +09:00
alkesh26
97909ddcf2 Changed webserver to web server. 2019-01-22 21:11:03 +05:30
George Claghorn
aac4d7f6ff Check all provided attributes of the message 2019-01-19 11:49:50 -05:00
Yuichi Takeuchi
88453093d5 Fix that adding attachments lose a body 2019-01-19 23:28:41 +09:00
Ryuta Kamizono
db077e8090 Allow using Action Mailbox on MySQL 5.5
Active Record still support MySQL 5.5 which doesn't support datetime
with precision.

9e34df0003/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb (L99-L101)

So we should check `supports_datetime_with_precision?` on the
connection.
2019-01-18 07:04:08 +09:00
Pratik Naik
a823b7d56f Specify a name for [ message_id, message_checksum ] index to ensure the name does not exceed the limit.
Also, update test schema to reflect the recent changes.
2019-01-17 14:14:45 -06:00
Pratik Naik
5cd733a334 Ensure Action Mailbox processes an email only once when received multiple times
This also adds a new column, message_checksum, to the action_mailbox_inbound_emails table
for storing SHA1 digest of the email source. Additionally, it makes generating the missing
message id deterministic and adds a unique index on message_checksum and message_id to
detect duplicate emails.
2019-01-17 11:13:40 -06:00
George Claghorn
512b5316dd
Add Exim and Qmail support to Action Mailbox 2019-01-12 21:38:26 -05:00