HEX
Server: Apache
System: Linux s198.coreserver.jp 5.15.0-151-generic #161-Ubuntu SMP Tue Jul 22 14:25:40 UTC 2025 x86_64
User: nagasaki (10062)
PHP: 7.1.33
Disabled: NONE
Upload Files
File: //usr/local/rvm/src/ruby-2.5.9/spec/ruby/core/kernel/singleton_class_spec.rb
describe "Kernel#singleton_class" do
  it "returns class extended from an object" do
    x = Object.new
    xs = class << x; self; end
    xs.should == x.singleton_class
  end

  it "returns NilClass for nil" do
    nil.singleton_class.should == NilClass
  end

  it "returns TrueClass for true" do
    true.singleton_class.should == TrueClass
  end

  it "returns FalseClass for false" do
    false.singleton_class.should == FalseClass
  end

  it "raises TypeError for Fixnum" do
    lambda { 123.singleton_class }.should raise_error(TypeError)
  end

  it "raises TypeError for Symbol" do
    lambda { :foo.singleton_class }.should raise_error(TypeError)
  end
end