From fb6b80562041e8d2378cad1b51f8c234fe76fd5e Mon Sep 17 00:00:00 2001 From: Xavier Noria Date: Tue, 17 Aug 2010 03:29:57 +0200 Subject: code gardening: we have assert_(nil|blank|present), more concise, with better default failure messages - let's use them --- actionpack/test/controller/output_escaping_test.rb | 2 +- actionpack/test/controller/render_test.rb | 12 ++++++------ .../test/controller/request_forgery_protection_test.rb | 2 +- actionpack/test/controller/test_test.rb | 2 +- actionpack/test/controller/webservice_test.rb | 4 ++-- 5 files changed, 11 insertions(+), 11 deletions(-) (limited to 'actionpack/test/controller') diff --git a/actionpack/test/controller/output_escaping_test.rb b/actionpack/test/controller/output_escaping_test.rb index 43a8c05cda..f6913a2138 100644 --- a/actionpack/test/controller/output_escaping_test.rb +++ b/actionpack/test/controller/output_escaping_test.rb @@ -3,7 +3,7 @@ require 'abstract_unit' class OutputEscapingTest < ActiveSupport::TestCase test "escape_html shouldn't die when passed nil" do - assert ERB::Util.h(nil).blank? + assert_blank ERB::Util.h(nil) end test "escapeHTML should escape strings" do diff --git a/actionpack/test/controller/render_test.rb b/actionpack/test/controller/render_test.rb index 258f511f10..9037a13343 100644 --- a/actionpack/test/controller/render_test.rb +++ b/actionpack/test/controller/render_test.rb @@ -1113,7 +1113,7 @@ class RenderTest < ActionController::TestCase def test_head_with_location_header get :head_with_location_header - assert @response.body.blank? + assert_blank @response.body assert_equal "/foo", @response.headers["Location"] assert_response :ok end @@ -1126,7 +1126,7 @@ class RenderTest < ActionController::TestCase end get :head_with_location_object - assert @response.body.blank? + assert_blank @response.body assert_equal "http://www.nextangle.com/customers/1", @response.headers["Location"] assert_response :ok end @@ -1134,7 +1134,7 @@ class RenderTest < ActionController::TestCase def test_head_with_custom_header get :head_with_custom_header - assert @response.body.blank? + assert_blank @response.body assert_equal "something", @response.headers["X-Custom-Header"] assert_response :ok end @@ -1414,7 +1414,7 @@ class EtagRenderTest < ActionController::TestCase assert_equal 200, @response.status.to_i assert_not_nil @response.last_modified assert_nil @response.etag - assert @response.body.present? + assert_present @response.body end def test_render_with_etag @@ -1499,7 +1499,7 @@ class LastModifiedRenderTest < ActionController::TestCase @request.if_modified_since = @last_modified get :conditional_hello assert_equal 304, @response.status.to_i - assert @response.body.blank?, @response.body + assert_blank @response.body assert_equal @last_modified, @response.headers['Last-Modified'] end @@ -1514,7 +1514,7 @@ class LastModifiedRenderTest < ActionController::TestCase @request.if_modified_since = 'Thu, 16 Jul 2008 00:00:00 GMT' get :conditional_hello assert_equal 200, @response.status.to_i - assert !@response.body.blank? + assert_present @response.body assert_equal @last_modified, @response.headers['Last-Modified'] end diff --git a/actionpack/test/controller/request_forgery_protection_test.rb b/actionpack/test/controller/request_forgery_protection_test.rb index be05ef6167..5ec760d4ea 100644 --- a/actionpack/test/controller/request_forgery_protection_test.rb +++ b/actionpack/test/controller/request_forgery_protection_test.rb @@ -251,7 +251,7 @@ class FreeCookieControllerTest < ActionController::TestCase test 'should not emit a csrf-token meta tag' do get :meta - assert @response.body.blank? + assert_blank @response.body end end diff --git a/actionpack/test/controller/test_test.rb b/actionpack/test/controller/test_test.rb index 7e7e4bd463..de2cab3e79 100644 --- a/actionpack/test/controller/test_test.rb +++ b/actionpack/test/controller/test_test.rb @@ -546,7 +546,7 @@ XML assert_equal "bar", @request.params[:foo] @request.recycle! post :no_op - assert @request.params[:foo].blank? + assert_blank @request.params[:foo] end def test_should_have_knowledge_of_client_side_cookie_state_even_if_they_are_not_set diff --git a/actionpack/test/controller/webservice_test.rb b/actionpack/test/controller/webservice_test.rb index 5942950b15..2e6cf48406 100644 --- a/actionpack/test/controller/webservice_test.rb +++ b/actionpack/test/controller/webservice_test.rb @@ -29,7 +29,7 @@ class WebServiceTest < ActionController::IntegrationTest def test_check_parameters with_test_route_set do get "/" - assert @controller.response.body.blank? + assert_blank @controller.response.body end end @@ -161,7 +161,7 @@ class WebServiceTest < ActionController::IntegrationTest def test_use_xml_ximple_with_empty_request with_test_route_set do assert_nothing_raised { post "/", "", {'CONTENT_TYPE' => 'application/xml'} } - assert @controller.response.body.blank? + assert_blank @controller.response.body end end -- cgit v1.2.3