Sha256: 29cb15507830f526707eb28837c0d81c3d0fcc7c038e2454c3cb408f72e95a9d
Contents?: true
Size: 825 Bytes
Versions: 83
Compression:
Stored size: 825 Bytes
Contents
require File.dirname(File.join(__rhoGetCurrentDir(), __FILE__)) + '/../../spec_helper' require File.dirname(File.join(__rhoGetCurrentDir(), __FILE__)) + '/fixtures/classes' describe "Module#extend_object" do it "extends the given object with constants and methods of self" do m = Module.new do const_set :C, "test" def test() "hello" end end o = mock('test') m.send(:extend_object, o) o.test.should == "hello" (class << o; C; end).should == "test" end it "is called when an object gets extended with self" do begin m = Module.new do def self.extend_object(o) $extended_object = o end end (o = mock('x')).extend(m) $extended_object.should == o ensure $extended_object = nil end end end
Version data entries
83 entries across 83 versions & 1 rubygems