From 82c39e1a0b5114e2d89a80883a41090567a83196 Mon Sep 17 00:00:00 2001 From: Daniel Colson Date: Thu, 25 Jan 2018 18:16:57 -0500 Subject: Use assert_empty and assert_not_empty --- actionpack/test/controller/action_pack_assertions_test.rb | 6 +++--- actionpack/test/controller/caching_test.rb | 2 +- actionpack/test/controller/flash_hash_test.rb | 6 +++--- actionpack/test/controller/integration_test.rb | 2 +- actionpack/test/controller/parameters/accessors_test.rb | 4 ++-- actionpack/test/controller/parameters/parameters_permit_test.rb | 2 +- actionpack/test/dispatch/cookies_test.rb | 4 ++-- actionpack/test/dispatch/request_test.rb | 2 +- actionpack/test/journey/routes_test.rb | 6 +++--- 9 files changed, 17 insertions(+), 17 deletions(-) (limited to 'actionpack') diff --git a/actionpack/test/controller/action_pack_assertions_test.rb b/actionpack/test/controller/action_pack_assertions_test.rb index 230d130d1c..504c77b8ef 100644 --- a/actionpack/test/controller/action_pack_assertions_test.rb +++ b/actionpack/test/controller/action_pack_assertions_test.rb @@ -301,7 +301,7 @@ class ActionPackAssertionsControllerTest < ActionController::TestCase def test_empty_flash process :flash_me_naked - assert_predicate flash, :empty? + assert_empty flash end def test_flash_exist @@ -312,7 +312,7 @@ class ActionPackAssertionsControllerTest < ActionController::TestCase def test_flash_does_not_exist process :nothing - assert_predicate flash, :empty? + assert_empty flash end def test_session_exist @@ -322,7 +322,7 @@ class ActionPackAssertionsControllerTest < ActionController::TestCase def session_does_not_exist process :nothing - assert_predicate session, :empty? + assert_empty session end def test_redirection_location diff --git a/actionpack/test/controller/caching_test.rb b/actionpack/test/controller/caching_test.rb index dfab69f896..8b596083d5 100644 --- a/actionpack/test/controller/caching_test.rb +++ b/actionpack/test/controller/caching_test.rb @@ -382,7 +382,7 @@ class ViewCacheDependencyTest < ActionController::TestCase end def test_view_cache_dependencies_are_empty_by_default - assert_predicate NoDependenciesController.new.view_cache_dependencies, :empty? + assert_empty NoDependenciesController.new.view_cache_dependencies end def test_view_cache_dependencies_are_listed_in_declaration_order diff --git a/actionpack/test/controller/flash_hash_test.rb b/actionpack/test/controller/flash_hash_test.rb index fd0d147cba..6c3ac26de1 100644 --- a/actionpack/test/controller/flash_hash_test.rb +++ b/actionpack/test/controller/flash_hash_test.rb @@ -92,11 +92,11 @@ module ActionDispatch end def test_empty? - assert_predicate @hash, :empty? + assert_empty @hash @hash["zomg"] = "bears" - assert_not_predicate @hash, :empty? + assert_not_empty @hash @hash.clear - assert_predicate @hash, :empty? + assert_empty @hash end def test_each diff --git a/actionpack/test/controller/integration_test.rb b/actionpack/test/controller/integration_test.rb index f69ece5972..a685f5868e 100644 --- a/actionpack/test/controller/integration_test.rb +++ b/actionpack/test/controller/integration_test.rb @@ -412,7 +412,7 @@ class IntegrationProcessTest < ActionDispatch::IntegrationTest get "/get_with_params", params: { foo: "bar" } - assert_predicate request.env["rack.input"].string, :empty? + assert_empty request.env["rack.input"].string assert_equal "foo=bar", request.env["QUERY_STRING"] assert_equal "foo=bar", request.query_string assert_equal "bar", request.parameters["foo"] diff --git a/actionpack/test/controller/parameters/accessors_test.rb b/actionpack/test/controller/parameters/accessors_test.rb index f5f759d875..7bcf8c380d 100644 --- a/actionpack/test/controller/parameters/accessors_test.rb +++ b/actionpack/test/controller/parameters/accessors_test.rb @@ -78,11 +78,11 @@ class ParametersAccessorsTest < ActiveSupport::TestCase test "empty? returns true when params contains no key/value pairs" do params = ActionController::Parameters.new - assert_predicate params, :empty? + assert_empty params end test "empty? returns false when any params are present" do - assert_not_predicate @params, :empty? + assert_not_empty @params end test "except retains permitted status" do diff --git a/actionpack/test/controller/parameters/parameters_permit_test.rb b/actionpack/test/controller/parameters/parameters_permit_test.rb index d73f42a052..295f3a03ef 100644 --- a/actionpack/test/controller/parameters/parameters_permit_test.rb +++ b/actionpack/test/controller/parameters/parameters_permit_test.rb @@ -54,7 +54,7 @@ class ParametersPermitTest < ActiveSupport::TestCase params = ActionController::Parameters.new(id: "1234") permitted = params.permit assert_predicate permitted, :permitted? - assert_predicate permitted, :empty? + assert_empty permitted end test "key: permitted scalar values" do diff --git a/actionpack/test/dispatch/cookies_test.rb b/actionpack/test/dispatch/cookies_test.rb index 40cbad3b0d..f01c9eed77 100644 --- a/actionpack/test/dispatch/cookies_test.rb +++ b/actionpack/test/dispatch/cookies_test.rb @@ -319,7 +319,7 @@ class CookiesTest < ActionController::TestCase def test_setting_the_same_value_to_cookie request.cookies[:user_name] = "david" get :authenticate - assert_predicate response.cookies, :empty? + assert_empty response.cookies end def test_setting_the_same_value_to_permanent_cookie @@ -401,7 +401,7 @@ class CookiesTest < ActionController::TestCase def test_delete_unexisting_cookie request.cookies.clear get :delete_cookie - assert_predicate @response.cookies, :empty? + assert_empty @response.cookies end def test_deleted_cookie_predicate diff --git a/actionpack/test/dispatch/request_test.rb b/actionpack/test/dispatch/request_test.rb index 8e5c953ad6..84a2d1f69e 100644 --- a/actionpack/test/dispatch/request_test.rb +++ b/actionpack/test/dispatch/request_test.rb @@ -1253,7 +1253,7 @@ class RequestVariant < BaseRequestTest test "clearing variant" do @request.variant = nil - assert_predicate @request.variant, :empty? + assert_empty @request.variant assert_not_predicate @request.variant, :phone? assert_not @request.variant.any?(:phone, :tablet) end diff --git a/actionpack/test/journey/routes_test.rb b/actionpack/test/journey/routes_test.rb index 3d9b2f724b..d5c81a8421 100644 --- a/actionpack/test/journey/routes_test.rb +++ b/actionpack/test/journey/routes_test.rb @@ -17,11 +17,11 @@ module ActionDispatch def test_clear mapper.get "/foo(/:id)", to: "foo#bar", as: "aaron" - assert_not_predicate routes, :empty? + assert_not_empty routes assert_equal 1, routes.length routes.clear - assert_predicate routes, :empty? + assert_empty routes assert_equal 0, routes.length end @@ -43,7 +43,7 @@ module ActionDispatch mapper.get "/foo(/:id)", to: "foo#bar", as: "aaron" assert_equal 1, @routes.anchored_routes.length - assert_predicate @routes.custom_routes, :empty? + assert_empty @routes.custom_routes mapper.get "/hello/:who", to: "foo#bar", as: "bar", who: /\d/ -- cgit v1.2.3