1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

cleaning up some warnings on 1.9.3

This commit is contained in:
Aaron Patterson 2011-02-07 16:44:27 -08:00
parent 08ef06dbf1
commit ea25224046
8 changed files with 25 additions and 27 deletions

View file

@ -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"]

View file

@ -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

View file

@ -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

View file

@ -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
end

View file

@ -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

View file

@ -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)

View file

@ -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

View file

@ -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']