Sha256: eef3b52f3ad512f19c91a76768a806710357b2d7974c78a1032e3d440edd73fa

Contents?: true

Size: 555 Bytes

Versions: 2

Compression:

Stored size: 555 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 attrs: { target => true } }

  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(dsl)
    target.should == expected
    dsl.value.should == 5
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mutaconf-0.1.1 spec/subclass_spec.rb
mutaconf-0.1.0 spec/subclass_spec.rb