Created
March 31, 2010 20:15
-
-
Save kronos/350826 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/spec/ruby/language/defined_spec.rb b/spec/ruby/language/defined_spec.rb | |
index 516f86b..e665fa0 100644 | |
--- a/spec/ruby/language/defined_spec.rb | |
+++ b/spec/ruby/language/defined_spec.rb | |
@@ -43,6 +43,10 @@ describe "The defined? keyword when called with a method name" do | |
defined?(Object.print).should be_nil | |
end | |
+ it "returns nil if the method is protected" do | |
+ defined?(DefinedSpecs::Basic.new.protected_method).should be_nil | |
+ end | |
+ | |
it "returns nil if the method is not defined" do | |
defined?(Kernel.defined_specs_undefined_method).should be_nil | |
end | |
diff --git a/spec/ruby/language/fixtures/defined.rb b/spec/ruby/language/fixtures/defined.rb | |
index 2b9628c..7a7243a 100644 | |
--- a/spec/ruby/language/fixtures/defined.rb | |
+++ b/spec/ruby/language/fixtures/defined.rb | |
@@ -29,6 +29,10 @@ module DefinedSpecs | |
def a_defined_method | |
end | |
+ def protected_method | |
+ end | |
+ protected :protected_method | |
+ | |
def local_variable_defined | |
x = 2 | |
defined? x |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment