summaryrefslogtreecommitdiff
path: root/spec/ruby/core/module/singleton_class_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/core/module/singleton_class_spec.rb')
-rw-r--r--spec/ruby/core/module/singleton_class_spec.rb27
1 files changed, 27 insertions, 0 deletions
diff --git a/spec/ruby/core/module/singleton_class_spec.rb b/spec/ruby/core/module/singleton_class_spec.rb
new file mode 100644
index 0000000000..052755b73b
--- /dev/null
+++ b/spec/ruby/core/module/singleton_class_spec.rb
@@ -0,0 +1,27 @@
+require_relative '../../spec_helper'
+
+describe "Module#singleton_class?" do
+ it "returns true for singleton classes" do
+ xs = self.singleton_class
+ xs.should.singleton_class?
+ end
+
+ it "returns false for other classes" do
+ c = Class.new
+ c.should_not.singleton_class?
+ end
+
+ describe "with singleton values" do
+ it "returns false for nil's singleton class" do
+ NilClass.should_not.singleton_class?
+ end
+
+ it "returns false for true's singleton class" do
+ TrueClass.should_not.singleton_class?
+ end
+
+ it "returns false for false's singleton class" do
+ FalseClass.should_not.singleton_class?
+ end
+ end
+end