Sha256: 48db48621093a7a893f4c6553f407daec02906670f1938bf059c7fc59b37f67f

Contents?: true

Size: 455 Bytes

Versions: 5

Compression:

Stored size: 455 Bytes

Contents

require_relative '../spec_helper'

describe 'Dependor::Constructor' do
  class SampleClassUsingConstructor
    include Dependor::Constructor(:foo, :bar, :baz)

    def as_instance_variables
      {foo: @foo, bar: @bar, baz: @baz}
    end
  end

  it 'defines a constructor with given parameters' do
    sample = SampleClassUsingConstructor.new('aaa', 'bbb', 'ccc')
    sample.as_instance_variables.should == {foo: 'aaa', bar: 'bbb', baz: 'ccc'}
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
dependor-0.0.5 spec/dependor/constructor_spec.rb
dependor-0.0.4 spec/dependor/constructor_spec.rb
dependor-0.0.3 spec/dependor/constructor_spec.rb
dependor-0.0.2 spec/dependor/constructor_spec.rb
dependor-0.0.1 spec/dependor/constructor_spec.rb