Skip to content
Browse files

Add spec for deep singleton class

  • Loading branch information...
1 parent 88bd8df commit e7591330dd7a6ce15026fc59f25c63a328ae851c @LTe committed Sep 12, 2012
Showing with 21 additions and 1 deletion.
  1. +10 −0 spec/ruby/fixtures/class.rb
  2. +11 −1 spec/ruby/language/singleton_class_spec.rb
View
10 spec/ruby/fixtures/class.rb
@@ -108,6 +108,16 @@ def self.example_class_method
class L; end
class M < L; end
+
+ class Deep
+ class << self
+ class << self
+ def deep; end
+ end
+ end
+ end
+
+ class Deeper < Deep; end
end
class Class
View
12 spec/ruby/language/singleton_class_spec.rb
@@ -282,6 +282,16 @@ def singleton_method; 1 end
end
end
end
+
+ describe "for a deep singleton class" do
+ it "does not raise method error" do
+ @deeper_sc = ClassSpecs::Deeper.singleton_class
+
+ lambda {
+ @deeper_sc.deep
+ }.should_not raise_error(NoMethodError)
+ end
+ end
end
describe "Instantiating a singleton class" do
@@ -296,4 +306,4 @@ def singleton_method; 1 end
Object.new.singleton_class.allocate
}.should raise_error(TypeError)
end
-end
+end

0 comments on commit e759133

Please sign in to comment.
Something went wrong with that request. Please try again.