From ea25224046679ac0d68f3c987c78ebafa491cee5 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Mon, 7 Feb 2011 16:44:27 -0800 Subject: cleaning up some warnings on 1.9.3 --- actionpack/test/controller/filters_test.rb | 10 +++++----- actionpack/test/controller/log_subscriber_test.rb | 20 ++++++++++---------- .../test/controller/new_base/bare_metal_test.rb | 2 +- .../test/controller/request/test_request_test.rb | 3 +-- actionpack/test/controller/routing_test.rb | 4 ++-- actionpack/test/dispatch/request_test.rb | 2 +- actionpack/test/dispatch/response_test.rb | 10 +++++----- .../test/dispatch/session/cookie_store_test.rb | 1 - 8 files changed, 25 insertions(+), 27 deletions(-) diff --git a/actionpack/test/controller/filters_test.rb b/actionpack/test/controller/filters_test.rb index 68febf425d..330fa276d0 100644 --- a/actionpack/test/controller/filters_test.rb +++ b/actionpack/test/controller/filters_test.rb @@ -664,7 +664,7 @@ class FilterTest < ActionController::TestCase end def test_prepending_and_appending_around_filter - controller = test_process(MixedFilterController) + test_process(MixedFilterController) assert_equal " before aroundfilter before procfilter before appended aroundfilter " + " after appended aroundfilter after procfilter after aroundfilter ", MixedFilterController.execution_log @@ -677,26 +677,26 @@ class FilterTest < ActionController::TestCase end def test_before_filter_rendering_breaks_filtering_chain_for_after_filter - response = test_process(RenderingController) + test_process(RenderingController) assert_equal %w( before_filter_rendering ), assigns["ran_filter"] assert !assigns["ran_action"] end def test_before_filter_redirects_breaks_filtering_chain_for_after_filter - response = test_process(BeforeFilterRedirectionController) + test_process(BeforeFilterRedirectionController) assert_response :redirect assert_equal "http://test.host/filter_test/before_filter_redirection/target_of_redirection", redirect_to_url assert_equal %w( before_filter_redirects ), assigns["ran_filter"] end def test_before_filter_rendering_breaks_filtering_chain_for_preprend_after_filter - response = test_process(RenderingForPrependAfterFilterController) + test_process(RenderingForPrependAfterFilterController) assert_equal %w( before_filter_rendering ), assigns["ran_filter"] assert !assigns["ran_action"] end def test_before_filter_redirects_breaks_filtering_chain_for_preprend_after_filter - response = test_process(BeforeFilterRedirectionForPrependAfterFilterController) + test_process(BeforeFilterRedirectionForPrependAfterFilterController) assert_response :redirect assert_equal "http://test.host/filter_test/before_filter_redirection_for_prepend_after_filter/target_of_redirection", redirect_to_url assert_equal %w( before_filter_redirects ), assigns["ran_filter"] diff --git a/actionpack/test/controller/log_subscriber_test.rb b/actionpack/test/controller/log_subscriber_test.rb index 21bbd83653..ddfa3df552 100644 --- a/actionpack/test/controller/log_subscriber_test.rb +++ b/actionpack/test/controller/log_subscriber_test.rb @@ -144,7 +144,7 @@ class ACLogSubscriberTest < ActionController::TestCase wait assert_equal 4, logs.size - assert_match /Read fragment views\/foo/, logs[1] + assert_match(/Read fragment views\/foo/, logs[1]) assert_match(/Write fragment views\/foo/, logs[2]) ensure @controller.config.perform_caching = true @@ -156,8 +156,8 @@ class ACLogSubscriberTest < ActionController::TestCase wait assert_equal 4, logs.size - assert_match /Read fragment views\/foo/, logs[1] - assert_match /Write fragment views\/foo/, logs[2] + assert_match(/Read fragment views\/foo/, logs[1]) + assert_match(/Write fragment views\/foo/, logs[2]) ensure @controller.config.perform_caching = true end @@ -173,15 +173,15 @@ class ACLogSubscriberTest < ActionController::TestCase ensure @controller.config.perform_caching = true end - + def test_process_action_with_exception_includes_http_status_code begin - get :with_exception - wait - rescue Exception => e - end - assert_equal 2, logs.size - assert_match(/Completed 500/, logs.last) + get :with_exception + wait + rescue Exception + end + assert_equal 2, logs.size + assert_match(/Completed 500/, logs.last) end def logs diff --git a/actionpack/test/controller/new_base/bare_metal_test.rb b/actionpack/test/controller/new_base/bare_metal_test.rb index 543c02b2c5..3ca29f1bcf 100644 --- a/actionpack/test/controller/new_base/bare_metal_test.rb +++ b/actionpack/test/controller/new_base/bare_metal_test.rb @@ -35,7 +35,7 @@ module BareMetalTest class HeadTest < ActiveSupport::TestCase test "head works on its own" do - status, headers, body = HeadController.action(:index).call(Rack::MockRequest.env_for("/")) + status = HeadController.action(:index).call(Rack::MockRequest.env_for("/")).first assert_equal 404, status end end diff --git a/actionpack/test/controller/request/test_request_test.rb b/actionpack/test/controller/request/test_request_test.rb index 0a39feb7fe..e624f11773 100644 --- a/actionpack/test/controller/request/test_request_test.rb +++ b/actionpack/test/controller/request/test_request_test.rb @@ -29,8 +29,7 @@ class ActionController::TestRequestTest < ActiveSupport::TestCase end def test_session_id_different_on_each_call - prev_id = assert_not_equal(@request.session_options[:id], ActionController::TestRequest.new.session_options[:id]) end -end \ No newline at end of file +end diff --git a/actionpack/test/controller/routing_test.rb b/actionpack/test/controller/routing_test.rb index 89f0d03c56..5f6f1b61c0 100644 --- a/actionpack/test/controller/routing_test.rb +++ b/actionpack/test/controller/routing_test.rb @@ -701,7 +701,7 @@ class RouteSetTest < ActiveSupport::TestCase set.draw do match '/users/index' => 'users#index' end - params = set.recognize_path('/users/index', :method => :get) + set.recognize_path('/users/index', :method => :get) assert_equal 1, set.routes.size end @@ -980,7 +980,7 @@ class RouteSetTest < ActiveSupport::TestCase match '/profile' => 'profile#index' end - params = set.recognize_path("/profile") rescue nil + set.recognize_path("/profile") rescue nil assert !Object.const_defined?("Profiler__"), "Profiler should not be loaded" end diff --git a/actionpack/test/dispatch/request_test.rb b/actionpack/test/dispatch/request_test.rb index 75b674ec1a..dd5bf5ec2d 100644 --- a/actionpack/test/dispatch/request_test.rb +++ b/actionpack/test/dispatch/request_test.rb @@ -427,7 +427,7 @@ class RequestTest < ActiveSupport::TestCase begin request = stub_request(mock_rack_env) request.parameters - rescue TypeError => e + rescue TypeError # rack will raise a TypeError when parsing this query string end assert_equal({}, request.parameters) diff --git a/actionpack/test/dispatch/response_test.rb b/actionpack/test/dispatch/response_test.rb index ab26d1a645..6f38714b2e 100644 --- a/actionpack/test/dispatch/response_test.rb +++ b/actionpack/test/dispatch/response_test.rb @@ -18,7 +18,7 @@ class ResponseTest < ActiveSupport::TestCase body.each { |part| parts << part } assert_equal ["Hello, World!"], parts end - + test "status handled properly in initialize" do assert_equal 200, ActionDispatch::Response.new('200 OK').status end @@ -26,7 +26,7 @@ class ResponseTest < ActiveSupport::TestCase test "utf8 output" do @response.body = [1090, 1077, 1089, 1090].pack("U*") - status, headers, body = @response.to_a + status, headers, _ = @response.to_a assert_equal 200, status assert_equal({ "Content-Type" => "text/html; charset=utf-8" @@ -52,20 +52,20 @@ class ResponseTest < ActiveSupport::TestCase test "content type" do [204, 304].each do |c| @response.status = c.to_s - status, headers, body = @response.to_a + _, headers, _ = @response.to_a assert !headers.has_key?("Content-Type"), "#{c} should not have Content-Type header" end [200, 302, 404, 500].each do |c| @response.status = c.to_s - status, headers, body = @response.to_a + _, headers, _ = @response.to_a assert headers.has_key?("Content-Type"), "#{c} did not have Content-Type header" end end test "does not include Status header" do @response.status = "200 OK" - status, headers, body = @response.to_a + _, headers, _ = @response.to_a assert !headers.has_key?('Status') end diff --git a/actionpack/test/dispatch/session/cookie_store_test.rb b/actionpack/test/dispatch/session/cookie_store_test.rb index 256d0781c7..27f55fd7ab 100644 --- a/actionpack/test/dispatch/session/cookie_store_test.rb +++ b/actionpack/test/dispatch/session/cookie_store_test.rb @@ -194,7 +194,6 @@ class CookieStoreTest < ActionDispatch::IntegrationTest with_test_route_set do get '/set_session_value' assert_response :success - session_payload = response.body assert_equal "_myapp_session=#{response.body}; path=/; HttpOnly", headers['Set-Cookie'] -- cgit v1.2.3