From e4191d56055d22b99ba2fca1415db7a514e2a1d3 Mon Sep 17 00:00:00 2001 From: Ben Orenstein Date: Tue, 25 May 2010 13:53:19 -0400 Subject: [PATCH] Use new assert_present and assert_blank methods [#4691 state:resolved] --- actionpack/test/controller/render_test.rb | 8 ++++---- .../controller/request_forgery_protection_test.rb | 2 +- actionpack/test/controller/test_test.rb | 2 +- actionpack/test/controller/webservice_test.rb | 4 ++-- actionpack/test/template/atom_feed_helper_test.rb | 2 +- .../test/cases/associations/join_model_test.rb | 2 +- activerecord/test/cases/method_scoping_test.rb | 2 +- activerecord/test/cases/relations_test.rb | 4 ++-- activesupport/test/caching_test.rb | 4 ++-- 9 files changed, 15 insertions(+), 15 deletions(-) diff --git a/actionpack/test/controller/render_test.rb b/actionpack/test/controller/render_test.rb index 2b1f2a2..f5496b6 100644 --- a/actionpack/test/controller/render_test.rb +++ b/actionpack/test/controller/render_test.rb @@ -1109,7 +1109,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 @@ -1122,7 +1122,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 @@ -1130,7 +1130,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 @@ -1403,7 +1403,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 diff --git a/actionpack/test/controller/request_forgery_protection_test.rb b/actionpack/test/controller/request_forgery_protection_test.rb index be05ef6..5ec760d 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 f9fc7a0..f299224 100644 --- a/actionpack/test/controller/test_test.rb +++ b/actionpack/test/controller/test_test.rb @@ -538,7 +538,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 5942950..2e6cf48 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 diff --git a/actionpack/test/template/atom_feed_helper_test.rb b/actionpack/test/template/atom_feed_helper_test.rb index 869ea22..fb43a8f 100644 --- a/actionpack/test/template/atom_feed_helper_test.rb +++ b/actionpack/test/template/atom_feed_helper_test.rb @@ -226,7 +226,7 @@ class AtomFeedTest < ActionController::TestCase get :index, :id=>"provide_builder" # because we pass in the non-default builder, the content generated by the # helper should go 'nowhere'. Leaving the response body blank. - assert @response.body.blank? + assert_blank @response.body end end diff --git a/activerecord/test/cases/associations/join_model_test.rb b/activerecord/test/cases/associations/join_model_test.rb index 447fe4d..af2e0b5 100644 --- a/activerecord/test/cases/associations/join_model_test.rb +++ b/activerecord/test/cases/associations/join_model_test.rb @@ -428,7 +428,7 @@ class AssociationsJoinModelTest < ActiveRecord::TestCase def test_has_many_through_uses_conditions_specified_on_the_has_many_association author = Author.find(:first) assert !author.comments.blank? - assert author.nonexistant_comments.blank? + assert_blank author.nonexistant_comments end def test_has_many_through_uses_correct_attributes diff --git a/activerecord/test/cases/method_scoping_test.rb b/activerecord/test/cases/method_scoping_test.rb index e93f22b..1993708 100644 --- a/activerecord/test/cases/method_scoping_test.rb +++ b/activerecord/test/cases/method_scoping_test.rb @@ -431,7 +431,7 @@ class NestedScopingTest < ActiveRecord::TestCase Comment.send(:with_scope, :create => { :body => "Hey guys, nested scopes are broken. Please fix!" }) do Comment.send(:with_exclusive_scope, :create => { :post_id => 1 }) do assert_equal({:post_id => 1}, Comment.scoped.send(:scope_for_create)) - assert Comment.new.body.blank? + assert_blank Comment.new.body comment = Comment.create :body => "Hey guys" end end diff --git a/activerecord/test/cases/relations_test.rb b/activerecord/test/cases/relations_test.rb index b6815af..86561ac 100644 --- a/activerecord/test/cases/relations_test.rb +++ b/activerecord/test/cases/relations_test.rb @@ -346,7 +346,7 @@ class RelationTest < ActiveRecord::TestCase def test_find_in_empty_array authors = Author.scoped.where(:id => []) - assert authors.all.blank? + assert_blank authors.all end def test_exists @@ -421,7 +421,7 @@ class RelationTest < ActiveRecord::TestCase def test_relation_merging_with_locks devs = Developer.lock.where("salary >= 80000").order("id DESC") & Developer.limit(2) - assert devs.locked.present? + assert_present devs.locked end def test_relation_merging_with_preload diff --git a/activesupport/test/caching_test.rb b/activesupport/test/caching_test.rb index 3e14c75..6083636 100644 --- a/activesupport/test/caching_test.rb +++ b/activesupport/test/caching_test.rb @@ -606,12 +606,12 @@ class CacheStoreLoggerTest < ActiveSupport::TestCase def test_logging @cache.fetch('foo') { 'bar' } - assert @buffer.string.present? + assert_present @buffer.string end def test_mute_logging @cache.mute { @cache.fetch('foo') { 'bar' } } - assert @buffer.string.blank? + assert_blank @buffer.string end end -- 1.7.0.6