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 --- activesupport/test/benchmarkable_test.rb | 2 +- activesupport/test/cache/stores/file_store_test.rb | 2 +- activesupport/test/class_cache_test.rb | 20 ++++++++-------- activesupport/test/deprecation_test.rb | 2 +- .../test/descendants_tracker_test_cases.rb | 2 +- .../descendants_tracker_with_autoloading_test.rb | 2 +- activesupport/test/inflector_test.rb | 28 +++++++++++----------- .../test/notifications/instrumenter_test.rb | 4 ++-- 8 files changed, 31 insertions(+), 31 deletions(-) (limited to 'activesupport') diff --git a/activesupport/test/benchmarkable_test.rb b/activesupport/test/benchmarkable_test.rb index 497b6bac8b..cb7a69cccf 100644 --- a/activesupport/test/benchmarkable_test.rb +++ b/activesupport/test/benchmarkable_test.rb @@ -26,7 +26,7 @@ class BenchmarkableTest < ActiveSupport::TestCase def test_without_block assert_raise(LocalJumpError) { benchmark } - assert_predicate buffer, :empty? + assert_empty buffer end def test_defaults diff --git a/activesupport/test/cache/stores/file_store_test.rb b/activesupport/test/cache/stores/file_store_test.rb index eb54c47f04..67eff9b94f 100644 --- a/activesupport/test/cache/stores/file_store_test.rb +++ b/activesupport/test/cache/stores/file_store_test.rb @@ -98,7 +98,7 @@ class FileStoreTest < ActiveSupport::TestCase end assert File.exist?(cache_dir), "Parent of top level cache dir was deleted!" assert File.exist?(sub_cache_dir), "Top level cache dir was deleted!" - assert_predicate Dir.entries(sub_cache_dir).reject { |f| ActiveSupport::Cache::FileStore::EXCLUDED_DIRS.include?(f) }, :empty? + assert_empty Dir.entries(sub_cache_dir).reject { |f| ActiveSupport::Cache::FileStore::EXCLUDED_DIRS.include?(f) } end def test_log_exception_when_cache_read_fails diff --git a/activesupport/test/class_cache_test.rb b/activesupport/test/class_cache_test.rb index c9c979b2f6..8cfcaedafd 100644 --- a/activesupport/test/class_cache_test.rb +++ b/activesupport/test/class_cache_test.rb @@ -11,17 +11,17 @@ module ActiveSupport end def test_empty? - assert_predicate @cache, :empty? + assert_empty @cache @cache.store(ClassCacheTest) - assert_not_predicate @cache, :empty? + assert_not_empty @cache end def test_clear! - assert_predicate @cache, :empty? + assert_empty @cache @cache.store(ClassCacheTest) - assert_not_predicate @cache, :empty? + assert_not_empty @cache @cache.clear! - assert_predicate @cache, :empty? + assert_empty @cache end def test_set_key @@ -40,29 +40,29 @@ module ActiveSupport end def test_get_constantizes - assert_predicate @cache, :empty? + assert_empty @cache assert_equal ClassCacheTest, @cache.get(ClassCacheTest.name) end def test_get_constantizes_fails_on_invalid_names - assert_predicate @cache, :empty? + assert_empty @cache assert_raise NameError do @cache.get("OmgTotallyInvalidConstantName") end end def test_get_alias - assert_predicate @cache, :empty? + assert_empty @cache assert_equal @cache[ClassCacheTest.name], @cache.get(ClassCacheTest.name) end def test_safe_get_constantizes - assert_predicate @cache, :empty? + assert_empty @cache assert_equal ClassCacheTest, @cache.safe_get(ClassCacheTest.name) end def test_safe_get_constantizes_doesnt_fail_on_invalid_names - assert_predicate @cache, :empty? + assert_empty @cache assert_nil @cache.safe_get("OmgTotallyInvalidConstantName") end diff --git a/activesupport/test/deprecation_test.rb b/activesupport/test/deprecation_test.rb index c61761901b..60673c032b 100644 --- a/activesupport/test/deprecation_test.rb +++ b/activesupport/test/deprecation_test.rb @@ -158,7 +158,7 @@ class DeprecationTest < ActiveSupport::TestCase stderr_output = capture(:stderr) { assert_nil behavior.call("Some error!", ["call stack!"], "horizon", "gem") } - assert_predicate stderr_output, :empty? + assert_empty stderr_output end def test_default_notify_behavior diff --git a/activesupport/test/descendants_tracker_test_cases.rb b/activesupport/test/descendants_tracker_test_cases.rb index fd860f74da..2c94c3c56c 100644 --- a/activesupport/test/descendants_tracker_test_cases.rb +++ b/activesupport/test/descendants_tracker_test_cases.rb @@ -37,7 +37,7 @@ module DescendantsTrackerTestCases mark_as_autoloaded(*ALL) do ActiveSupport::DescendantsTracker.clear ALL.each do |k| - assert_predicate ActiveSupport::DescendantsTracker.descendants(k), :empty? + assert_empty ActiveSupport::DescendantsTracker.descendants(k) end end end diff --git a/activesupport/test/descendants_tracker_with_autoloading_test.rb b/activesupport/test/descendants_tracker_with_autoloading_test.rb index 10efbfbb8c..d4fedb5a67 100644 --- a/activesupport/test/descendants_tracker_with_autoloading_test.rb +++ b/activesupport/test/descendants_tracker_with_autoloading_test.rb @@ -12,7 +12,7 @@ class DescendantsTrackerWithAutoloadingTest < ActiveSupport::TestCase mark_as_autoloaded(*ALL) do ActiveSupport::DescendantsTracker.clear ALL.each do |k| - assert_predicate ActiveSupport::DescendantsTracker.descendants(k), :empty? + assert_empty ActiveSupport::DescendantsTracker.descendants(k) end end end diff --git a/activesupport/test/inflector_test.rb b/activesupport/test/inflector_test.rb index 4c15d54af4..5e50acf5db 100644 --- a/activesupport/test/inflector_test.rb +++ b/activesupport/test/inflector_test.rb @@ -460,12 +460,12 @@ class InflectorTest < ActiveSupport::TestCase ActiveSupport::Inflector.inflections(:es) { |inflect| inflect.clear } - assert_predicate ActiveSupport::Inflector.inflections(:es).plurals, :empty? - assert_predicate ActiveSupport::Inflector.inflections(:es).singulars, :empty? - assert_predicate ActiveSupport::Inflector.inflections(:es).uncountables, :empty? - assert_not_predicate ActiveSupport::Inflector.inflections.plurals, :empty? - assert_not_predicate ActiveSupport::Inflector.inflections.singulars, :empty? - assert_not_predicate ActiveSupport::Inflector.inflections.uncountables, :empty? + assert_empty ActiveSupport::Inflector.inflections(:es).plurals + assert_empty ActiveSupport::Inflector.inflections(:es).singulars + assert_empty ActiveSupport::Inflector.inflections(:es).uncountables + assert_not_empty ActiveSupport::Inflector.inflections.plurals + assert_not_empty ActiveSupport::Inflector.inflections.singulars + assert_not_empty ActiveSupport::Inflector.inflections.uncountables end def test_clear_all @@ -478,10 +478,10 @@ class InflectorTest < ActiveSupport::TestCase inflect.clear :all - assert_predicate inflect.plurals, :empty? - assert_predicate inflect.singulars, :empty? - assert_predicate inflect.uncountables, :empty? - assert_predicate inflect.humans, :empty? + assert_empty inflect.plurals + assert_empty inflect.singulars + assert_empty inflect.uncountables + assert_empty inflect.humans end end @@ -495,10 +495,10 @@ class InflectorTest < ActiveSupport::TestCase inflect.clear - assert_predicate inflect.plurals, :empty? - assert_predicate inflect.singulars, :empty? - assert_predicate inflect.uncountables, :empty? - assert_predicate inflect.humans, :empty? + assert_empty inflect.plurals + assert_empty inflect.singulars + assert_empty inflect.uncountables + assert_empty inflect.humans end end diff --git a/activesupport/test/notifications/instrumenter_test.rb b/activesupport/test/notifications/instrumenter_test.rb index 1d76c91d30..d5c9e82e9f 100644 --- a/activesupport/test/notifications/instrumenter_test.rb +++ b/activesupport/test/notifications/instrumenter_test.rb @@ -47,13 +47,13 @@ module ActiveSupport def test_start instrumenter.start("foo", payload) assert_equal [["foo", instrumenter.id, payload]], notifier.starts - assert_predicate notifier.finishes, :empty? + assert_empty notifier.finishes end def test_finish instrumenter.finish("foo", payload) assert_equal [["foo", instrumenter.id, payload]], notifier.finishes - assert_predicate notifier.starts, :empty? + assert_empty notifier.starts end end end -- cgit v1.2.3