summaryrefslogtreecommitdiff
path: root/spec/ruby/core/module/private_method_defined_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/core/module/private_method_defined_spec.rb')
-rw-r--r--spec/ruby/core/module/private_method_defined_spec.rb88
1 files changed, 43 insertions, 45 deletions
diff --git a/spec/ruby/core/module/private_method_defined_spec.rb b/spec/ruby/core/module/private_method_defined_spec.rb
index 951f17aaa7..01fc8f8fb9 100644
--- a/spec/ruby/core/module/private_method_defined_spec.rb
+++ b/spec/ruby/core/module/private_method_defined_spec.rb
@@ -70,53 +70,51 @@ describe "Module#private_method_defined?" do
ModuleSpecs::CountsMixin.private_method_defined?(str).should == true
end
- ruby_version_is "2.6" do
- describe "when passed true as a second optional argument" do
- it "performs a lookup in ancestors" do
- ModuleSpecs::Child.private_method_defined?(:public_child, true).should == false
- ModuleSpecs::Child.private_method_defined?(:protected_child, true).should == false
- ModuleSpecs::Child.private_method_defined?(:accessor_method, true).should == false
- ModuleSpecs::Child.private_method_defined?(:private_child, true).should == true
-
- # Defined in Parent
- ModuleSpecs::Child.private_method_defined?(:public_parent, true).should == false
- ModuleSpecs::Child.private_method_defined?(:protected_parent, true).should == false
- ModuleSpecs::Child.private_method_defined?(:private_parent, true).should == true
-
- # Defined in Module
- ModuleSpecs::Child.private_method_defined?(:public_module, true).should == false
- ModuleSpecs::Child.private_method_defined?(:protected_module, true).should == false
- ModuleSpecs::Child.private_method_defined?(:private_module, true).should == true
-
- # Defined in SuperModule
- ModuleSpecs::Child.private_method_defined?(:public_super_module, true).should == false
- ModuleSpecs::Child.private_method_defined?(:protected_super_module, true).should == false
- ModuleSpecs::Child.private_method_defined?(:private_super_module, true).should == true
- end
+ describe "when passed true as a second optional argument" do
+ it "performs a lookup in ancestors" do
+ ModuleSpecs::Child.private_method_defined?(:public_child, true).should == false
+ ModuleSpecs::Child.private_method_defined?(:protected_child, true).should == false
+ ModuleSpecs::Child.private_method_defined?(:accessor_method, true).should == false
+ ModuleSpecs::Child.private_method_defined?(:private_child, true).should == true
+
+ # Defined in Parent
+ ModuleSpecs::Child.private_method_defined?(:public_parent, true).should == false
+ ModuleSpecs::Child.private_method_defined?(:protected_parent, true).should == false
+ ModuleSpecs::Child.private_method_defined?(:private_parent, true).should == true
+
+ # Defined in Module
+ ModuleSpecs::Child.private_method_defined?(:public_module, true).should == false
+ ModuleSpecs::Child.private_method_defined?(:protected_module, true).should == false
+ ModuleSpecs::Child.private_method_defined?(:private_module, true).should == true
+
+ # Defined in SuperModule
+ ModuleSpecs::Child.private_method_defined?(:public_super_module, true).should == false
+ ModuleSpecs::Child.private_method_defined?(:protected_super_module, true).should == false
+ ModuleSpecs::Child.private_method_defined?(:private_super_module, true).should == true
end
+ end
- describe "when passed false as a second optional argument" do
- it "checks only the class itself" do
- ModuleSpecs::Child.private_method_defined?(:public_child, false).should == false
- ModuleSpecs::Child.private_method_defined?(:protected_child, false).should == false
- ModuleSpecs::Child.private_method_defined?(:accessor_method, false).should == false
- ModuleSpecs::Child.private_method_defined?(:private_child, false).should == true
-
- # Defined in Parent
- ModuleSpecs::Child.private_method_defined?(:public_parent, false).should == false
- ModuleSpecs::Child.private_method_defined?(:protected_parent, false).should == false
- ModuleSpecs::Child.private_method_defined?(:private_parent, false).should == false
-
- # Defined in Module
- ModuleSpecs::Child.private_method_defined?(:public_module, false).should == false
- ModuleSpecs::Child.private_method_defined?(:protected_module, false).should == false
- ModuleSpecs::Child.private_method_defined?(:private_module, false).should == false
-
- # Defined in SuperModule
- ModuleSpecs::Child.private_method_defined?(:public_super_module, false).should == false
- ModuleSpecs::Child.private_method_defined?(:protected_super_module, false).should == false
- ModuleSpecs::Child.private_method_defined?(:private_super_module, false).should == false
- end
+ describe "when passed false as a second optional argument" do
+ it "checks only the class itself" do
+ ModuleSpecs::Child.private_method_defined?(:public_child, false).should == false
+ ModuleSpecs::Child.private_method_defined?(:protected_child, false).should == false
+ ModuleSpecs::Child.private_method_defined?(:accessor_method, false).should == false
+ ModuleSpecs::Child.private_method_defined?(:private_child, false).should == true
+
+ # Defined in Parent
+ ModuleSpecs::Child.private_method_defined?(:public_parent, false).should == false
+ ModuleSpecs::Child.private_method_defined?(:protected_parent, false).should == false
+ ModuleSpecs::Child.private_method_defined?(:private_parent, false).should == false
+
+ # Defined in Module
+ ModuleSpecs::Child.private_method_defined?(:public_module, false).should == false
+ ModuleSpecs::Child.private_method_defined?(:protected_module, false).should == false
+ ModuleSpecs::Child.private_method_defined?(:private_module, false).should == false
+
+ # Defined in SuperModule
+ ModuleSpecs::Child.private_method_defined?(:public_super_module, false).should == false
+ ModuleSpecs::Child.private_method_defined?(:protected_super_module, false).should == false
+ ModuleSpecs::Child.private_method_defined?(:private_super_module, false).should == false
end
end
end