diff options
Diffstat (limited to 'actionpack/test')
-rw-r--r-- | actionpack/test/controller/action_pack_assertions_test.rb | 2 | ||||
-rw-r--r-- | actionpack/test/controller/http_basic_authentication_test.rb | 2 | ||||
-rw-r--r-- | actionpack/test/controller/new_base/render_streaming_test.rb | 2 | ||||
-rw-r--r-- | actionpack/test/controller/test_case_test.rb (renamed from actionpack/test/controller/test_test.rb) | 38 | ||||
-rw-r--r-- | actionpack/test/dispatch/request/xml_params_parsing_test.rb | 8 | ||||
-rw-r--r-- | actionpack/test/template/streaming_render_test.rb | 2 |
6 files changed, 38 insertions, 16 deletions
diff --git a/actionpack/test/controller/action_pack_assertions_test.rb b/actionpack/test/controller/action_pack_assertions_test.rb index 5252e43c25..fab70c71d6 100644 --- a/actionpack/test/controller/action_pack_assertions_test.rb +++ b/actionpack/test/controller/action_pack_assertions_test.rb @@ -165,7 +165,7 @@ class ActionPackAssertionsControllerTest < ActionController::TestCase match 'route_one', :to => 'action_pack_assertions#nothing', :as => :route_one match ':controller/:action' end - set.install_helpers + set.install_helpers([ActionController::Base, ActionView::Base]) process :redirect_to_named_route assert_redirected_to 'http://test.host/route_one' diff --git a/actionpack/test/controller/http_basic_authentication_test.rb b/actionpack/test/controller/http_basic_authentication_test.rb index 364e96d4f6..7286b249c7 100644 --- a/actionpack/test/controller/http_basic_authentication_test.rb +++ b/actionpack/test/controller/http_basic_authentication_test.rb @@ -132,6 +132,6 @@ class HttpBasicAuthenticationTest < ActionController::TestCase private def encode_credentials(username, password) - "Basic #{ActiveSupport::Base64.encode64("#{username}:#{password}")}" + "Basic #{::Base64.encode64("#{username}:#{password}")}" end end diff --git a/actionpack/test/controller/new_base/render_streaming_test.rb b/actionpack/test/controller/new_base/render_streaming_test.rb index 1a17e24914..1532bd5c98 100644 --- a/actionpack/test/controller/new_base/render_streaming_test.rb +++ b/actionpack/test/controller/new_base/render_streaming_test.rb @@ -111,4 +111,4 @@ module RenderStreaming assert_equal cache, headers["Cache-Control"] end end -end if defined?(Fiber) +end diff --git a/actionpack/test/controller/test_test.rb b/actionpack/test/controller/test_case_test.rb index b3b7ece518..73b860ac18 100644 --- a/actionpack/test/controller/test_test.rb +++ b/actionpack/test/controller/test_case_test.rb @@ -171,6 +171,21 @@ XML assert_equal params.to_query, @response.body end + + def test_document_body_and_params_with_post + post :test_params, :id => 1 + assert_equal("{\"id\"=>\"1\", \"controller\"=>\"test_test/test\", \"action\"=>\"test_params\"}", @response.body) + end + + def test_document_body_with_post + post :render_body, "document body" + assert_equal "document body", @response.body + end + + def test_document_body_with_put + put :render_body, "document body" + assert_equal "document body", @response.body + end def test_process_without_flash process :set_flash @@ -178,12 +193,12 @@ XML end def test_process_with_flash - process :set_flash, nil, nil, { "test" => "value" } + process :set_flash, "GET", nil, nil, { "test" => "value" } assert_equal '>value<', flash['test'] end def test_process_with_flash_now - process :set_flash_now, nil, nil, { "test_now" => "value_now" } + process :set_flash_now, "GET", nil, nil, { "test_now" => "value_now" } assert_equal '>value_now<', flash['test_now'] end @@ -196,7 +211,7 @@ XML end def test_process_with_session_arg - process :no_op, nil, { 'string' => 'value1', :symbol => 'value2' } + process :no_op, "GET", nil, { 'string' => 'value1', :symbol => 'value2' } assert_equal 'value1', session['string'] assert_equal 'value1', session[:string] assert_equal 'value2', session['symbol'] @@ -227,18 +242,25 @@ XML end def test_process_with_request_uri_with_params - process :test_uri, :id => 7 + process :test_uri, "GET", :id => 7 assert_equal "/test_test/test/test_uri/7", @response.body end + + def test_process_with_old_api + assert_deprecated do + process :test_uri, :id => 7 + assert_equal "/test_test/test/test_uri/7", @response.body + end + end def test_process_with_request_uri_with_params_with_explicit_uri @request.env['PATH_INFO'] = "/explicit/uri" - process :test_uri, :id => 7 + process :test_uri, "GET", :id => 7 assert_equal "/explicit/uri", @response.body end def test_process_with_query_string - process :test_query_string, :q => 'test' + process :test_query_string, "GET", :q => 'test' assert_equal "q=test", @response.body end @@ -250,9 +272,9 @@ XML end def test_multiple_calls - process :test_only_one_param, :left => true + process :test_only_one_param, "GET", :left => true assert_equal "OK", @response.body - process :test_only_one_param, :right => true + process :test_only_one_param, "GET", :right => true assert_equal "OK", @response.body end diff --git a/actionpack/test/dispatch/request/xml_params_parsing_test.rb b/actionpack/test/dispatch/request/xml_params_parsing_test.rb index d8fa751548..0984f00066 100644 --- a/actionpack/test/dispatch/request/xml_params_parsing_test.rb +++ b/actionpack/test/dispatch/request/xml_params_parsing_test.rb @@ -41,7 +41,7 @@ class XmlParamsParsingTest < ActionDispatch::IntegrationTest test "parses single file" do with_test_routing do - xml = "<person><name>David</name><avatar type='file' name='me.jpg' content_type='image/jpg'>#{ActiveSupport::Base64.encode64('ABC')}</avatar></person>" + xml = "<person><name>David</name><avatar type='file' name='me.jpg' content_type='image/jpg'>#{::Base64.encode64('ABC')}</avatar></person>" post "/parse", xml, default_headers assert_response :ok @@ -55,7 +55,7 @@ class XmlParamsParsingTest < ActionDispatch::IntegrationTest test "logs error if parsing unsuccessful" do with_test_routing do output = StringIO.new - xml = "<person><name>David</name><avatar type='file' name='me.jpg' content_type='image/jpg'>#{ActiveSupport::Base64.encode64('ABC')}</avatar></pineapple>" + xml = "<person><name>David</name><avatar type='file' name='me.jpg' content_type='image/jpg'>#{::Base64.encode64('ABC')}</avatar></pineapple>" post "/parse", xml, default_headers.merge('action_dispatch.show_exceptions' => true, 'action_dispatch.logger' => Logger.new(output)) assert_response :error output.rewind && err = output.read @@ -80,8 +80,8 @@ class XmlParamsParsingTest < ActionDispatch::IntegrationTest <person> <name>David</name> <avatars> - <avatar type='file' name='me.jpg' content_type='image/jpg'>#{ActiveSupport::Base64.encode64('ABC')}</avatar> - <avatar type='file' name='you.gif' content_type='image/gif'>#{ActiveSupport::Base64.encode64('DEF')}</avatar> + <avatar type='file' name='me.jpg' content_type='image/jpg'>#{::Base64.encode64('ABC')}</avatar> + <avatar type='file' name='you.gif' content_type='image/gif'>#{::Base64.encode64('DEF')}</avatar> </avatars> </person> end_body diff --git a/actionpack/test/template/streaming_render_test.rb b/actionpack/test/template/streaming_render_test.rb index 4d01352b43..520bf3a824 100644 --- a/actionpack/test/template/streaming_render_test.rb +++ b/actionpack/test/template/streaming_render_test.rb @@ -106,4 +106,4 @@ class FiberedTest < ActiveSupport::TestCase buffered_render(:template => "test/nested_streaming", :layout => "layouts/streaming") end -end if defined?(Fiber) +end |