aboutsummaryrefslogtreecommitdiffstats
path: root/test/unit/controller_test.rb
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2018-09-18 16:11:03 -0700
committerDavid Heinemeier Hansson <david@loudthinking.com>2018-09-18 16:11:03 -0700
commit1219b070d73d0e980d5ac58a5a583048976e5539 (patch)
treef5e0ddfb04df117f10c2767094f2f6757a79c75f /test/unit/controller_test.rb
parent31ff0f7b6cc4ec7bbc70a9472e01215cd9b046e8 (diff)
downloadrails-1219b070d73d0e980d5ac58a5a583048976e5539.tar.gz
rails-1219b070d73d0e980d5ac58a5a583048976e5539.tar.bz2
rails-1219b070d73d0e980d5ac58a5a583048976e5539.zip
Add test for unsupported content type
Diffstat (limited to 'test/unit/controller_test.rb')
-rw-r--r--test/unit/controller_test.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/unit/controller_test.rb b/test/unit/controller_test.rb
index c9ba1ba45f..f2a49f415f 100644
--- a/test/unit/controller_test.rb
+++ b/test/unit/controller_test.rb
@@ -12,6 +12,14 @@ class ActionMailroom::InboundEmailsControllerTest < ActionDispatch::IntegrationT
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 -> { ActionMailroom::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') }