Sha256: 4a45358ccdb143845c90694abc7d3ccccebedecb9479ab8e0415df4fdc1e40a6

Contents?: true

Size: 1.31 KB

Versions: 9

Compression:

Stored size: 1.31 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
Configliere.use :config_block

describe "Configliere::ConfigBlock" do
  before do
    @config = Configliere::Param.new :normal_param => 'normal'
  end

  describe 'resolving' do
    it 'runs blocks' do
      @block_watcher = 'watcher'
      # @block_watcher.should_receive(:fnord).with(@config)
      @block_watcher.should_receive(:fnord)
      @config.finally{|arg| @block_watcher.fnord(arg) }
      @config.resolve!
    end
    it 'resolves blocks last' do
      Configliere.use :config_block, :encrypted
      @config.should_receive(:resolve_types!).ordered
      @config.should_receive(:resolve_finally_blocks!).ordered
      @config.resolve!
    end

    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

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

end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
configliere-0.4.14 spec/configliere/config_block_spec.rb
configliere-0.4.13 spec/configliere/config_block_spec.rb
configliere-0.4.12 spec/configliere/config_block_spec.rb
configliere-0.4.11 spec/configliere/config_block_spec.rb
configliere-0.4.10 spec/configliere/config_block_spec.rb
configliere-0.4.8 spec/configliere/config_block_spec.rb
configliere-0.4.7 spec/configliere/config_block_spec.rb
configliere-0.4.6 spec/configliere/config_block_spec.rb
configliere-0.4.5 spec/configliere/config_block_spec.rb