summaryrefslogtreecommitdiff
path: root/spec/ruby/language/def_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/language/def_spec.rb')
-rw-r--r--spec/ruby/language/def_spec.rb33
1 files changed, 11 insertions, 22 deletions
diff --git a/spec/ruby/language/def_spec.rb b/spec/ruby/language/def_spec.rb
index 82c89a0d08..a589b4750b 100644
--- a/spec/ruby/language/def_spec.rb
+++ b/spec/ruby/language/def_spec.rb
@@ -306,32 +306,21 @@ end
describe "Redefining a singleton method" do
it "does not inherit a previously set visibility" do
o = Object.new
+ sc = o.singleton_class
- class << o; private; def foo; end; end;
-
- class << o; should have_private_instance_method(:foo); end
-
- class << o; def foo; end; end;
-
- class << o; should_not have_private_instance_method(:foo); end
- class << o; should have_instance_method(:foo); end
-
- end
-end
-
-describe "Redefining a singleton method" do
- it "does not inherit a previously set visibility" do
- o = Object.new
-
- class << o; private; def foo; end; end;
-
- class << o; should have_private_instance_method(:foo); end
+ class << o
+ private
+ def foo; end
+ end
- class << o; def foo; end; end;
+ sc.private_instance_methods(false).should.include?(:foo)
- class << o; should_not have_private_instance_method(:foo); end
- class << o; should have_instance_method(:foo); end
+ class << o
+ def foo; end
+ end
+ sc.private_instance_methods(false).should_not.include?(:foo)
+ sc.should.method_defined?(:foo)
end
end