From 1219b070d73d0e980d5ac58a5a583048976e5539 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Tue, 18 Sep 2018 16:11:03 -0700 Subject: Add test for unsupported content type --- test/unit/controller_test.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'test/unit/controller_test.rb') 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') } -- cgit v1.2.3