File: constructor_spec.rb

package info (click to toggle)
ruby-dependor 1.0.1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 264 kB
  • sloc: ruby: 557; makefile: 2; sh: 1
file content (16 lines) | stat: -rw-r--r-- 443 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
require '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