Sha256: 2a191e0eeee907aa60f756c86d30cc8a5bccfb012698e1993506cb4a8e5ad419

Contents?: true

Size: 1.29 KB

Versions: 14

Compression:

Stored size: 1.29 KB

Contents

describe "Module" do
  describe "reachable?" do
    it "should be false for an anonymous module" do
      Module.new.should.not.be.reachable
    end
    
    it "should be false for an anonymous class" do
      Class.new.should.not.be.reachable
    end

    it "should be true for a named module" do
      Kernel.should.be.reachable
    end
    
    it "should be true for a named class" do
      Object.should.be.reachable
    end

    it "should be false for a named class whose constant has gone" do
      class C; end
      c = C

      Object.send(:remove_const, :C)

      c.should.not.be.reachable
    end

    it "should be false for a named module whose constant has gone" do
      module M; end
      m = M
    
      Object.send(:remove_const, :M)
    
      m.should.not.be.reachable
    end
    
    it "should be false for a named class whose constant was redefined" do
      class C; end
      c = C
    
      Object.send(:remove_const, :C)
    
      class C; end
    
      C.should.be.reachable
      c.should.not.be.reachable
    end
    
    it "should be false for a named module whose constant was redefined" do
      module M; end
      m = M
    
      Object.send(:remove_const, :M)
    
      module M; end
    
      M.should.be.reachable
      m.should.not.be.reachable
    end
  end
end

Version data entries

14 entries across 14 versions & 2 rubygems

Version Path
motion-support-1.2.1 spec/motion-support/core_ext/module/reachable_spec.rb
motion-support-1.1.1 spec/motion-support/core_ext/module/reachable_spec.rb
motion-support-1.2.0 spec/motion-support/core_ext/module/reachable_spec.rb
motion-support-1.1.0 spec/motion-support/core_ext/module/reachable_spec.rb
motion-support-1.0.0 spec/motion-support/core_ext/module/reachable_spec.rb
motion-support-0.3.0 spec/motion-support/core_ext/module/reachable_spec.rb
motion_blender-support-0.2.8 spec/motion-support/core_ext/module/reachable_spec.rb
motion_blender-support-0.2.7 spec/motion-support/core_ext/module/reachable_spec.rb
motion-support-0.2.6 spec/motion-support/core_ext/module/reachable_spec.rb
motion-support-0.2.5 spec/motion-support/core_ext/module/reachable_spec.rb
motion-support-0.2.4 spec/motion-support/core_ext/module/reachable_spec.rb
motion-support-0.2.3 spec/motion-support/core_ext/module/reachable_spec.rb
motion-support-0.2.2 spec/motion-support/core_ext/module/reachable_spec.rb
motion-support-0.2.0 spec/motion-support/core_ext/module/reachable_spec.rb