Sha256: e5e046c8d387bb536ee0e96e21c18ffcf28718872b45986897f0045e464604ea

Contents?: true

Size: 547 Bytes

Versions: 4

Compression:

Stored size: 547 Bytes

Contents

require 'helper'

describe Mutaconf::DSL do

  class CustomDSL < Mutaconf::DSL
    attr_reader :value

    def initialize options = {}
      super options
      @value = 0
    end

    def increase by
      @value += by
    end
  end

  let(:target){ {} }
  let(:dsl){ CustomDSL.new target: target }

  it "should work when subclassed" do
    result = dsl.configure do
      a 'b'
      c 'd'
      increase 5
    end
    expected = { a: 'b', c: 'd' }
    result.should be(target)
    target.should == expected
    dsl.value.should == 5
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
mutaconf-0.0.7 spec/subclass_spec.rb
mutaconf-0.0.6 spec/subclass_spec.rb
mutaconf-0.0.5 spec/subclass_spec.rb
mutaconf-0.0.4 spec/subclass_spec.rb