summaryrefslogtreecommitdiff
path: root/spec/ruby/language/singleton_class_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/language/singleton_class_spec.rb')
-rw-r--r--spec/ruby/language/singleton_class_spec.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/spec/ruby/language/singleton_class_spec.rb b/spec/ruby/language/singleton_class_spec.rb
index c1fb682ea0..7512f0eb39 100644
--- a/spec/ruby/language/singleton_class_spec.rb
+++ b/spec/ruby/language/singleton_class_spec.rb
@@ -291,3 +291,20 @@ describe "Instantiating a singleton class" do
}.should raise_error(TypeError)
end
end
+
+describe "Frozen properties" do
+ it "is frozen if the object it is created from is frozen" do
+ o = Object.new
+ o.freeze
+ klass = o.singleton_class
+ klass.frozen?.should == true
+ end
+
+ it "will be frozen if the object it is created from becomes frozen" do
+ o = Object.new
+ klass = o.singleton_class
+ klass.frozen?.should == false
+ o.freeze
+ klass.frozen?.should == true
+ end
+end