aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/core_ext/module
diff options
context:
space:
mode:
authorDaniel Colson <danieljamescolson@gmail.com>2018-01-25 18:14:09 -0500
committerDaniel Colson <danieljamescolson@gmail.com>2018-01-25 23:32:59 -0500
commit94333a4c31bd10c1f358c538a167e6a4589bae2d (patch)
tree9106c349180bbdcba2e7839e0e79144e3a15a055 /activesupport/test/core_ext/module
parent211adb47e76b358ea15a3f756431c042ab231c23 (diff)
downloadrails-94333a4c31bd10c1f358c538a167e6a4589bae2d.tar.gz
rails-94333a4c31bd10c1f358c538a167e6a4589bae2d.tar.bz2
rails-94333a4c31bd10c1f358c538a167e6a4589bae2d.zip
Use assert_predicate and assert_not_predicate
Diffstat (limited to 'activesupport/test/core_ext/module')
-rw-r--r--activesupport/test/core_ext/module/anonymous_test.rb8
-rw-r--r--activesupport/test/core_ext/module/attribute_aliasing_test.rb14
-rw-r--r--activesupport/test/core_ext/module/reachable_test.rb20
3 files changed, 21 insertions, 21 deletions
diff --git a/activesupport/test/core_ext/module/anonymous_test.rb b/activesupport/test/core_ext/module/anonymous_test.rb
index 606f22c9b5..e03c217015 100644
--- a/activesupport/test/core_ext/module/anonymous_test.rb
+++ b/activesupport/test/core_ext/module/anonymous_test.rb
@@ -5,12 +5,12 @@ require "active_support/core_ext/module/anonymous"
class AnonymousTest < ActiveSupport::TestCase
test "an anonymous class or module are anonymous" do
- assert Module.new.anonymous?
- assert Class.new.anonymous?
+ assert_predicate Module.new, :anonymous?
+ assert_predicate Class.new, :anonymous?
end
test "a named class or module are not anonymous" do
- assert !Kernel.anonymous?
- assert !Object.anonymous?
+ assert_not_predicate Kernel, :anonymous?
+ assert_not_predicate Object, :anonymous?
end
end
diff --git a/activesupport/test/core_ext/module/attribute_aliasing_test.rb b/activesupport/test/core_ext/module/attribute_aliasing_test.rb
index 187a0f4da2..81aac224f9 100644
--- a/activesupport/test/core_ext/module/attribute_aliasing_test.rb
+++ b/activesupport/test/core_ext/module/attribute_aliasing_test.rb
@@ -30,15 +30,15 @@ class AttributeAliasingTest < ActiveSupport::TestCase
def test_attribute_alias
e = AttributeAliasing::Email.new
- assert !e.subject?
+ assert_not_predicate e, :subject?
e.title = "Upgrade computer"
assert_equal "Upgrade computer", e.subject
- assert e.subject?
+ assert_predicate e, :subject?
e.subject = "We got a long way to go"
assert_equal "We got a long way to go", e.title
- assert e.title?
+ assert_predicate e, :title?
end
def test_aliasing_to_uppercase_attributes
@@ -47,15 +47,15 @@ class AttributeAliasingTest < ActiveSupport::TestCase
# to more sensible ones, everything goes *foof*.
e = AttributeAliasing::Email.new
- assert !e.body?
- assert !e.Data?
+ assert_not_predicate e, :body?
+ assert_not_predicate e, :Data?
e.body = "No, really, this is not a joke."
assert_equal "No, really, this is not a joke.", e.Data
- assert e.Data?
+ assert_predicate e, :Data?
e.Data = "Uppercased methods are the suck"
assert_equal "Uppercased methods are the suck", e.body
- assert e.body?
+ assert_predicate e, :body?
end
end
diff --git a/activesupport/test/core_ext/module/reachable_test.rb b/activesupport/test/core_ext/module/reachable_test.rb
index 097a72fa5b..f356d46957 100644
--- a/activesupport/test/core_ext/module/reachable_test.rb
+++ b/activesupport/test/core_ext/module/reachable_test.rb
@@ -6,15 +6,15 @@ require "active_support/core_ext/module/reachable"
class AnonymousTest < ActiveSupport::TestCase
test "an anonymous class or module is not reachable" do
assert_deprecated do
- assert !Module.new.reachable?
- assert !Class.new.reachable?
+ assert_not_predicate Module.new, :reachable?
+ assert_not_predicate Class.new, :reachable?
end
end
test "ordinary named classes or modules are reachable" do
assert_deprecated do
- assert Kernel.reachable?
- assert Object.reachable?
+ assert_predicate Kernel, :reachable?
+ assert_predicate Object, :reachable?
end
end
@@ -26,8 +26,8 @@ class AnonymousTest < ActiveSupport::TestCase
self.class.send(:remove_const, :M)
assert_deprecated do
- assert !c.reachable?
- assert !m.reachable?
+ assert_not_predicate c, :reachable?
+ assert_not_predicate m, :reachable?
end
end
@@ -42,10 +42,10 @@ class AnonymousTest < ActiveSupport::TestCase
eval "module M; end"
assert_deprecated do
- assert C.reachable?
- assert M.reachable?
- assert !c.reachable?
- assert !m.reachable?
+ assert_predicate C, :reachable?
+ assert_predicate M, :reachable?
+ assert_not_predicate c, :reachable?
+ assert_not_predicate m, :reachable?
end
end
end