Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

test_test deprecation and cosmetics

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4967 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
commit 9b424f04cac9a0fc62053f092775f8f36024a35a 1 parent be54075
@jeremy jeremy authored
Showing with 24 additions and 22 deletions.
  1. +24 −22 actionpack/test/controller/test_test.rb
View
46 actionpack/test/controller/test_test.rb
@@ -15,8 +15,8 @@ def render_raw_post
def test_params
render :text => params.inspect
- end
-
+ end
+
def test_uri
render :text => request.request_uri
end
@@ -41,7 +41,7 @@ def test_html_output
</html>
HTML
end
-
+
def test_only_one_param
render :text => (params[:left] && params[:right]) ? "EEP, Both here!" : "OK"
end
@@ -49,7 +49,7 @@ def test_only_one_param
def test_remote_addr
render :text => (request.remote_addr || "not specified")
end
-
+
def test_file_upload
render :text => params[:file].size
end
@@ -99,8 +99,8 @@ def test_raw_post_handling
def test_process_without_flash
process :set_flash
assert_equal '><', flash['test']
- end
-
+ end
+
def test_process_with_flash
process :set_flash, nil, nil, { "test" => "value" }
assert_equal '>value<', flash['test']
@@ -120,12 +120,12 @@ def test_process_with_request_uri_with_params_with_explicit_uri
@request.set_REQUEST_URI "/explicit/uri"
process :test_uri, :id => 7
assert_equal "/explicit/uri", @response.body
- end
-
- def test_multiple_calls
+ end
+
+ def test_multiple_calls
process :test_only_one_param, :left => true
assert_equal "OK", @response.body
- process :test_only_one_param, :right => true
+ process :test_only_one_param, :right => true
assert_equal "OK", @response.body
end
@@ -243,7 +243,7 @@ def test_assert_tag_children_only
process :test_html_output
# there is a tag containing only one child with an id of 'foo'
- assert_tag :children => { :count => 1,
+ assert_tag :children => { :count => 1,
:only => { :attributes => { :id => "foo" } } }
# there is no tag containing only one 'li' child
assert_no_tag :children => { :count => 1, :only => { :tag => "li" } }
@@ -257,7 +257,7 @@ def test_assert_tag_content
# the output does not contain the string "test"
assert_no_tag :content => "test"
end
-
+
def test_assert_tag_multiple
process :test_html_output
@@ -277,7 +277,7 @@ def test_assert_tag_multiple
def test_assert_tag_children_without_content
process :test_html_output
-
+
# there is a form tag with an 'input' child which is a self closing tag
assert_tag :tag => "form",
:children => { :count => 1,
@@ -324,7 +324,7 @@ def test_array_path_parameter_handled_properly
map.connect 'file/*path', :controller => 'test_test/test', :action => 'test_params'
map.connect ':controller/:action/:id'
end
-
+
get :test_params, :path => ['hello', 'world']
assert_equal ['hello', 'world'], @request.path_parameters['path']
assert_equal 'hello/world', @request.path_parameters['path'].to_s
@@ -343,13 +343,13 @@ def test_assert_realistic_path_parameters
def test_with_routing_places_routes_back
assert ActionController::Routing::Routes
routes_id = ActionController::Routing::Routes.object_id
-
+
begin
with_routing { raise 'fail' }
fail 'Should not be here.'
rescue RuntimeError
end
-
+
assert ActionController::Routing::Routes
assert_equal routes_id, ActionController::Routing::Routes.object_id
end
@@ -390,33 +390,35 @@ def test_header_properly_reset_after_get_request
end
end
end
-
+
FILES_DIR = File.dirname(__FILE__) + '/../fixtures/multipart'
-
+
def test_test_uploaded_file
filename = 'mona_lisa.jpg'
path = "#{FILES_DIR}/#{filename}"
content_type = 'image/png'
-
+
file = ActionController::TestUploadedFile.new(path, content_type)
assert_equal filename, file.original_filename
assert_equal content_type, file.content_type
assert_equal file.path, file.local_path
assert_equal File.read(path), file.read
end
-
+
def test_fixture_file_upload
post :test_file_upload, :file => fixture_file_upload(FILES_DIR + "/mona_lisa.jpg", "image/jpg")
assert_equal 159528, @response.body
end
-
+
def test_test_uploaded_file_exception_when_file_doesnt_exist
assert_raise(RuntimeError) { ActionController::TestUploadedFile.new('non_existent_file') }
end
def test_assert_redirected_to_symbol
with_foo_routing do |set|
- get :redirect_to_symbol
+ assert_deprecated(/generate_url.*redirect_to/) do
+ get :redirect_to_symbol
+ end
assert_response :redirect
assert_redirected_to :generate_url
end
Please sign in to comment.
Something went wrong with that request. Please try again.