Sha256: ae8b0936a43b795ec16173f4ac18398eec0a7548d449bde53f5ad49e32a63a99
Contents?: true
Size: 667 Bytes
Versions: 3
Compression:
Stored size: 667 Bytes
Contents
module ClassSpecs class A; end end describe "A singleton class" do it "is NilClass for nil" do nil.singleton_class.should == NilClass end it "is a singleton Class instance" do o = mock('x') o.singleton_class.should be_kind_of(Class) o.singleton_class.should_not equal(Object) end it "is a Class for classes" do ClassSpecs::A::singleton_class.should be_kind_of(Class) end end describe "Defining instance methods on a singleton class" do before do @object = Object.new class << @object def singleton_method; 1 end end end it "defines public methods" do @object.singleton_method.should eq(1) end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
opal-0.3.41 | spec/language/singleton_class_spec.rb |
opal-0.3.40 | spec/language/singleton_class_spec.rb |
opal-0.3.39 | spec/language/singleton_class_spec.rb |