test/requests/error_json_test.rb in rambulance-1.1.1 vs test/requests/error_json_test.rb in rambulance-2.0.0

- old
+ new

@@ -72,9 +72,24 @@ elsif Rails::VERSION::STRING >= '4.2.0' assert_equal 201, response.status end end + test 'returns an appropriate status when JSON data is malformed' do + if Rails::VERSION::STRING >= '5.1.0' + post '/unknown/path', params: 'x', headers: { "CONTENT_TYPE" => "application/json" } + else + post '/unknown/path', 'x', "CONTENT_TYPE" => "application/json" + end + + if Rails::VERSION::STRING >= '5.0.0' + assert_equal 404, response.status + elsif Rails::VERSION::STRING >= '4.2.0' + assert_equal 400, response.status + end + end + + private def without_layouts `mv test/fake_app/app/views/layouts/application.html.erb .` `mv test/fake_app/app/views/layouts/error.html.erb .`