Sha256: e0e8e9a71aff82aee1e231dfe7e83f805b3edccdaf62b1ed798354787e613245

Contents?: true

Size: 729 Bytes

Versions: 5

Compression:

Stored size: 729 Bytes

Contents

require_relative '../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

5 entries across 5 versions & 1 rubygems

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