summaryrefslogtreecommitdiff
path: root/spec/ruby/core/kernel/define_singleton_method_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/core/kernel/define_singleton_method_spec.rb')
-rw-r--r--spec/ruby/core/kernel/define_singleton_method_spec.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/spec/ruby/core/kernel/define_singleton_method_spec.rb b/spec/ruby/core/kernel/define_singleton_method_spec.rb
index 2d8b1bf413..24acec84f5 100644
--- a/spec/ruby/core/kernel/define_singleton_method_spec.rb
+++ b/spec/ruby/core/kernel/define_singleton_method_spec.rb
@@ -111,4 +111,10 @@ describe "Kernel#define_singleton_method" do
cls.foo.should == :ok
}.should_not raise_error(NoMethodError)
end
+
+ it "cannot define a singleton method with a frozen singleton class" do
+ o = Object.new
+ o.freeze
+ -> { o.define_singleton_method(:foo) { 1 } }.should raise_error(FrozenError)
+ end
end