Sha256: 6dbb3e88da711e86f1f2a88f0a57c624252b6953070dbb299fa15706e400dacf

Contents?: true

Size: 1.7 KB

Versions: 4

Compression:

Stored size: 1.7 KB

Contents

require 'spec_helper'

describe SimpleDeploy::Misc::AttributeMerger do

  before do
    @config_mock = mock 'config'
    @mapper_mock = mock 'mapper'
    @logger_stub = stub 'logger', :info => true

    @stacks  = ['stack1', 'stack2']
    @options = { :config      => @config_mock,
                 :environment  => 'default',
                 :logger       => @logger_stub,
                 :attributes   => [ { 'attrib1' => 'val1' } ],
                 :input_stacks => @stacks,
                 :template     => '/tmp/file.json' }
    SimpleDeploy::Stack::OutputMapper.should_receive(:new).
                                    with(:environment => @options[:environment],
                                         :config      => @options[:config],
                                         :logger      => @options[:logger]).
                                    and_return @mapper_mock
    @merger = SimpleDeploy::Misc::AttributeMerger.new
  end

  it "should return the consolidated list of attributes" do
    @mapper_mock.should_receive(:map_outputs_from_stacks).
                 with(:stacks   => @options[:input_stacks],
                      :template => @options[:template]).
                 and_return [ { 'attrib2' => 'val2' } ]
    @merger.merge(@options).should == [ { 'attrib1' => 'val1' },
                                        { 'attrib2' => 'val2' } ]
  end

  it "should return provided attributes over outputs" do
    @mapper_mock.should_receive(:map_outputs_from_stacks).
                 with(:stacks   => @options[:input_stacks],
                      :template => @options[:template]).
                 and_return [ { 'attrib1' => 'val2' } ]
    @merger.merge(@options).should == [ { 'attrib1' => 'val1' } ]
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
simple_deploy-0.7.2 spec/misc/attribute_merger_spec.rb
simple_deploy-0.7.2.beta.1 spec/misc/attribute_merger_spec.rb
simple_deploy-0.7.1 spec/misc/attribute_merger_spec.rb
simple_deploy-0.7.0 spec/misc/attribute_merger_spec.rb