Sha256: 814758fffa15aa8e06cfda419244527a0bc8ab5b6d59c9723c7365bf89db8c19

Contents?: true

Size: 1.46 KB

Versions: 14

Compression:

Stored size: 1.46 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')

describe "Configliere::Param" do
  before do
    @config = Configliere::Param.new :hat => :cat, :basket => :lotion, :moon => { :man => :smiling }
  end

  describe 'calling #defaults' do
    it 'deep_merges new params' do
      @config.defaults :basket => :tasket, :moon => { :cow => :jumping }
      @config.should == { :hat => :cat, :basket => :tasket, :moon => { :man => :smiling, :cow => :jumping } }
    end
    it 'returns self, to allow chaining' do
      obj = @config.defaults(:basket => :ball)
      obj.should equal(@config)
    end
  end

  describe 'adding plugins with #use' do
    before do
      Configliere.should_receive(:use).with(:foobar)
    end
    it 'requires the corresponding library' do
      obj = @config.use(:foobar)
    end
    it 'returns self, to allow chaining' do
      obj = @config.use(:foobar)
      obj.should equal(@config)
    end
    it 'invokes the on_use handler' do
      Configliere::Param.on_use(:foobar) do
        method_on_config(:param)
      end
      @config.should_receive(:method_on_config).with(:param)
      @config.use(:foobar)
    end
  end

  describe '#resolve!' do
    it 'calls super and returns self' do
      Configliere::ParamParent.class_eval do def resolve!() dummy ; end ; end
      @config.should_receive(:dummy)
      @config.resolve!.should equal(@config)
      Configliere::ParamParent.class_eval do def resolve!() self ; end ; end
    end
  end

end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
configliere-0.4.22 spec/configliere/param_spec.rb
configliere-0.4.18 spec/configliere/param_spec.rb
configliere-0.4.17 spec/configliere/param_spec.rb
configliere-0.4.16 spec/configliere/param_spec.rb
configliere-0.4.14 spec/configliere/param_spec.rb
configliere-0.4.13 spec/configliere/param_spec.rb
configliere-0.4.12 spec/configliere/param_spec.rb
configliere-0.4.11 spec/configliere/param_spec.rb
configliere-0.4.10 spec/configliere/param_spec.rb
configliere-0.4.8 spec/configliere/param_spec.rb
configliere-0.4.7 spec/configliere/param_spec.rb
configliere-0.4.6 spec/configliere/param_spec.rb
configliere-0.4.5 spec/configliere/param_spec.rb
configliere-0.4.4 spec/configliere/param_spec.rb