aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/test')
-rw-r--r--actionpack/test/controller/routing_test.rb6
-rw-r--r--actionpack/test/dispatch/debug_exceptions_test.rb10
-rw-r--r--actionpack/test/dispatch/request_test.rb20
3 files changed, 29 insertions, 7 deletions
diff --git a/actionpack/test/controller/routing_test.rb b/actionpack/test/controller/routing_test.rb
index 4a2b02a003..a39fede5b9 100644
--- a/actionpack/test/controller/routing_test.rb
+++ b/actionpack/test/controller/routing_test.rb
@@ -289,12 +289,6 @@ class LegacyRouteSetTests < ActiveSupport::TestCase
assert_equal({:id=>"1", :filters=>"foo", :format=>"js"}, params)
end
- def test_draw_with_block_arity_one_raises
- assert_raise(RuntimeError) do
- rs.draw { |map| map.match '/:controller(/:action(/:id))' }
- end
- end
-
def test_specific_controller_action_failure
rs.draw do
mount lambda {} => "/foo"
diff --git a/actionpack/test/dispatch/debug_exceptions_test.rb b/actionpack/test/dispatch/debug_exceptions_test.rb
index 89c3e75a50..30772bd9ed 100644
--- a/actionpack/test/dispatch/debug_exceptions_test.rb
+++ b/actionpack/test/dispatch/debug_exceptions_test.rb
@@ -166,6 +166,14 @@ class DebugExceptionsTest < ActionDispatch::IntegrationTest
assert_equal "text/plain", response.content_type
assert_match(/RuntimeError\npuke/, body)
+ Rails.stub :root, Pathname.new('.') do
+ get "/", headers: xhr_request_env
+
+ assert_response 500
+ assert_match 'Extracted source (around line #', body
+ assert_select 'pre', { count: 0 }, body
+ end
+
get "/not_found", headers: xhr_request_env
assert_response 404
assert_no_match(/<body>/, body)
@@ -364,7 +372,7 @@ class DebugExceptionsTest < ActionDispatch::IntegrationTest
assert_select 'pre code a:first', %r{test/dispatch/debug_exceptions_test\.rb:\d+:in `call}
end
- # assert framework trace that that threw the error is first
+ # assert framework trace that threw the error is first
assert_select '#Framework-Trace' do
assert_select 'pre code a:first', /method_that_raises/
end
diff --git a/actionpack/test/dispatch/request_test.rb b/actionpack/test/dispatch/request_test.rb
index 22240699d9..08c4554721 100644
--- a/actionpack/test/dispatch/request_test.rb
+++ b/actionpack/test/dispatch/request_test.rb
@@ -1212,3 +1212,23 @@ class RequestVariant < BaseRequestTest
end
end
end
+
+class RequestFormData < BaseRequestTest
+ test 'media_type is from the FORM_DATA_MEDIA_TYPES array' do
+ assert stub_request('CONTENT_TYPE' => 'application/x-www-form-urlencoded').form_data?
+ assert stub_request('CONTENT_TYPE' => 'multipart/form-data').form_data?
+ end
+
+ test 'media_type is not from the FORM_DATA_MEDIA_TYPES array' do
+ assert !stub_request('CONTENT_TYPE' => 'application/xml').form_data?
+ assert !stub_request('CONTENT_TYPE' => 'multipart/related').form_data?
+ end
+
+ test 'no Content-Type header is provided and the request_method is POST' do
+ request = stub_request('REQUEST_METHOD' => 'POST')
+
+ assert_equal '', request.media_type
+ assert_equal 'POST', request.request_method
+ assert !request.form_data?
+ end
+end