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-2.2.6 spec/framework_spec/app/spec/core/module/included_spec.rb
rhodes-2.2.6.beta.1 spec/framework_spec/app/spec/core/module/included_spec.rb
rhodes-2.2.5 spec/framework_spec/app/spec/core/module/included_spec.rb
rhodes-2.2.5.beta.3 spec/framework_spec/app/spec/core/module/included_spec.rb
rhodes-2.2.5.beta.2 spec/framework_spec/app/spec/core/module/included_spec.rb
rhodes-2.2.5.beta.1 spec/framework_spec/app/spec/core/module/included_spec.rb
rhodes-2.2.4.beta.1 spec/framework_spec/app/spec/core/module/included_spec.rb
rhodes-2.2.3 spec/framework_spec/app/spec/core/module/included_spec.rb
rhodes-2.2.3.beta.1 spec/framework_spec/app/spec/core/module/included_spec.rb
rhodes-2.2.2 spec/framework_spec/app/spec/core/module/included_spec.rb
rhodes-2.2.2.beta.1 spec/framework_spec/app/spec/core/module/included_spec.rb
rhodes-2.2.1 spec/framework_spec/app/spec/core/module/included_spec.rb
rhodes-2.2.1.beta.2 spec/framework_spec/app/spec/core/module/included_spec.rb
rhodes-2.2.1.beta.1 spec/framework_spec/app/spec/core/module/included_spec.rb
rhodes-2.2.0 spec/framework_spec/app/spec/core/module/included_spec.rb
rhodes-2.2.0.beta.3 spec/framework_spec/app/spec/core/module/included_spec.rb
rhodes-2.2.0.beta.2 spec/framework_spec/app/spec/core/module/included_spec.rb
rhodes-2.2.0.beta.1 spec/framework_spec/app/spec/core/module/included_spec.rb
rhodes-2.1.0 spec/framework_spec/app/spec/core/module/included_spec.rb
rhodes-2.0.3 spec/framework_spec/app/spec/core/module/included_spec.rb