Sha256: 3b385a760f65f05039d63d43edcb7345fd9c177ab243c20f0110151417c96eaa

Contents?: true

Size: 717 Bytes

Versions: 3

Compression:

Stored size: 717 Bytes

Contents

require 'spec_helper'

require 'dependor/shorty'

describe Dependor::Shorty do
  class SampleClassThatUsesTakes
    takes :foo, :bar, :baz

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

    def as_attributes
      {foo: foo, bar: bar, baz: baz}
    end
  end

  subject{ SampleClassThatUsesTakes.new('foo value', 'bar value', 'baz value') }

  it 'defines a constructor with given names' do
    subject.as_instance_variables.should == { foo: 'foo value',
      bar: 'bar value',
      baz: 'baz value'
    }
  end

  it 'defines attr_reader for the given names' do
    subject.as_attributes.should == { foo: 'foo value',
      bar: 'bar value',
      baz: 'baz value'
    }
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
dependor-1.0.1 spec/dependor/shorty_spec.rb
dependor-1.0.0 spec/dependor/shorty_spec.rb
dependor-0.0.6 spec/dependor/shorty_spec.rb