Sha256: 3c6dbeb2e8381a5e42fbd435e742fd23882a600b2baba71cd3541ef8c4608af4

Contents?: true

Size: 641 Bytes

Versions: 1

Compression:

Stored size: 641 Bytes

Contents

require 'paramix'

describe "include with parametric mixins" do

  module M
    include Paramix::Parametric

    parameterized do |params|

      public :f do
        params[:p]
      end

    end
  end

  class I1
    include M[:p => "mosh"]
  end

  class I2
    include M[:p => "many"]
  end

  class E1
    extend M[:p => "mosh"]
  end

  class E2
    extend M[:p => "many"]
  end

  it "should vary the return value of the instance methods" do
    I1.new.f.should == "mosh"
    I2.new.f.should == "many"
  end

  it "should vary the return value of the class methods " do
    E1.f.should == "mosh"
    E2.f.should == "many"
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
paramix-2.0.1 spec/paramix_include_spec.rb