Sha256: 3158685ff9ee45b5c43aaecf6412f8668930b2e3b0c3f6af4b4d4110ff7f1e72

Contents?: true

Size: 903 Bytes

Versions: 83

Compression:

Stored size: 903 Bytes

Contents

require File.dirname(File.join(__rhoGetCurrentDir(), __FILE__)) + '/../../spec_helper'
require File.dirname(File.join(__rhoGetCurrentDir(), __FILE__)) + '/fixtures/classes'

describe "Module#included" do
  it "is invoked when self is included in another module or class" do
    begin
      m = Module.new do
        def self.included(o)
          $included_by = o
        end
      end

      c = Class.new { include m }

      $included_by.should == c
    ensure
      $included_by = nil
    end
  end

  it "allows extending self with the object into which it is being included" do
    m = Module.new do
      def self.included(o)
        o.extend(self)
      end

      def test
        :passed
      end
    end

    c = Class.new{ include(m) }
    c.test.should == :passed
  end

  it "is private in its default implementation" do
    Module.new.private_methods.should include(:included)
  end
end

Version data entries

83 entries across 83 versions & 1 rubygems

Version Path
rhodes-3.1.1 spec/framework_spec/app/spec/core/module/included_spec.rb
rhodes-3.1.1.beta spec/framework_spec/app/spec/core/module/included_spec.rb
rhodes-3.1.0 spec/framework_spec/app/spec/core/module/included_spec.rb
rhodes-3.1.0.beta.5 spec/framework_spec/app/spec/core/module/included_spec.rb
rhodes-3.1.0.beta.4 spec/framework_spec/app/spec/core/module/included_spec.rb
rhodes-3.1.0.beta.3 spec/framework_spec/app/spec/core/module/included_spec.rb
rhodes-3.1.0.beta.2 spec/framework_spec/app/spec/core/module/included_spec.rb
rhodes-3.1.0.beta.1 spec/framework_spec/app/spec/core/module/included_spec.rb
rhodes-3.0.2 spec/framework_spec/app/spec/core/module/included_spec.rb
rhodes-3.0.2.beta.1 spec/framework_spec/app/spec/core/module/included_spec.rb
rhodes-3.0.1 spec/framework_spec/app/spec/core/module/included_spec.rb
rhodes-3.0.1.beta.8 spec/framework_spec/app/spec/core/module/included_spec.rb
rhodes-3.0.1.beta.7 spec/framework_spec/app/spec/core/module/included_spec.rb
rhodes-3.0.1.beta.6 spec/framework_spec/app/spec/core/module/included_spec.rb
rhodes-3.0.1.beta.5 spec/framework_spec/app/spec/core/module/included_spec.rb
rhodes-3.0.1.beta.4 spec/framework_spec/app/spec/core/module/included_spec.rb
rhodes-3.0.1.beta.3 spec/framework_spec/app/spec/core/module/included_spec.rb
rhodes-3.0.1.beta.2 spec/framework_spec/app/spec/core/module/included_spec.rb
rhodes-3.0.0 spec/framework_spec/app/spec/core/module/included_spec.rb
rhodes-3.0.0.beta.7 spec/framework_spec/app/spec/core/module/included_spec.rb