diff options
author | George Claghorn <george.claghorn@gmail.com> | 2018-11-05 14:21:27 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-05 14:21:27 -0500 |
commit | 152a442b1902050265ddcef56f5506b3bfbb12e4 (patch) | |
tree | bd365d76299e978a6e974a64f5ff3d47f0614514 /test/unit | |
parent | c474daefb18e9bab96f6f0bb0bb30dfc00058cb3 (diff) | |
parent | ac7fd0e56886eb134554789e014d2736b95d7042 (diff) | |
download | rails-152a442b1902050265ddcef56f5506b3bfbb12e4.tar.gz rails-152a442b1902050265ddcef56f5506b3bfbb12e4.tar.bz2 rails-152a442b1902050265ddcef56f5506b3bfbb12e4.zip |
Merge pull request #1 from basecamp/ingresses
Accept inbound emails from a variety of ingresses
Diffstat (limited to 'test/unit')
-rw-r--r-- | test/unit/controller_test.rb | 27 | ||||
-rw-r--r-- | test/unit/inbound_email/message_id_test.rb | 4 |
2 files changed, 1 insertions, 30 deletions
diff --git a/test/unit/controller_test.rb b/test/unit/controller_test.rb deleted file mode 100644 index 508e561244..0000000000 --- a/test/unit/controller_test.rb +++ /dev/null @@ -1,27 +0,0 @@ -require_relative '../test_helper' - -class ActionMailbox::InboundEmailsControllerTest < ActionDispatch::IntegrationTest - test "receiving a valid RFC 822 message" do - assert_difference -> { ActionMailbox::InboundEmail.count }, +1 do - post_inbound_email "welcome.eml" - end - - assert_response :created - - inbound_email = ActionMailbox::InboundEmail.last - assert_equal file_fixture('../files/welcome.eml').read, inbound_email.raw_email.download - end - - test "rejecting a message of an unsupported type" do - assert_no_difference -> { ActionMailbox::InboundEmail.count } do - post rails_inbound_emails_url, params: { message: fixture_file_upload('files/text.txt', 'text/plain') } - end - - assert_response :unsupported_media_type - end - - private - def post_inbound_email(fixture_name) - post rails_inbound_emails_url, params: { message: fixture_file_upload("files/#{fixture_name}", 'message/rfc822') } - end -end diff --git a/test/unit/inbound_email/message_id_test.rb b/test/unit/inbound_email/message_id_test.rb index aa9ce90b4c..c744a5bf99 100644 --- a/test/unit/inbound_email/message_id_test.rb +++ b/test/unit/inbound_email/message_id_test.rb @@ -7,9 +7,7 @@ class ActionMailbox::InboundEmail::MessageIdTest < ActiveSupport::TestCase end test "message id is generated if its missing" do - source_without_message_id = "Date: Fri, 28 Sep 2018 11:08:55 -0700\r\nTo: a@example.com\r\nMime-Version: 1.0\r\nContent-Type: text/plain\r\nContent-Transfer-Encoding: 7bit\r\n\r\nHello!" - inbound_email = create_inbound_email Tempfile.new.tap { |raw_email| raw_email.write source_without_message_id } - + inbound_email = create_inbound_email "Date: Fri, 28 Sep 2018 11:08:55 -0700\r\nTo: a@example.com\r\nMime-Version: 1.0\r\nContent-Type: text/plain\r\nContent-Transfer-Encoding: 7bit\r\n\r\nHello!" assert_not_nil inbound_email.message_id end end |