Sha256: 0ba3c8681a7768de027a547ac914c10093a0744a35c3eeedc6c7cbc4ab225378

Contents?: true

Size: 1.66 KB

Versions: 24

Compression:

Stored size: 1.66 KB

Contents

require 'spec_helper'
require 'simple_deploy/cli'

describe SimpleDeploy::CLI::Create do
  include_context 'cli config'
  include_context 'double stubbed logger'
  include_context 'stubbed stack', :name        => 'mytest',
                                   :environment => 'test'

  before do
    @config_env            = mock 'environment config'
    @attribute_merger_mock = mock 'attribute merger'

    @options = { :attributes  => [ 'attr1=val1' ],
                 :input_stack => [ 'stack1' ],
                 :environment => 'test',
                 :name        => 'mytest',
                 :log_level   => 'info',
                 :template    => '/tmp/test.json' }
    Trollop.stub :options => @options

    SimpleDeploy.stub(:environments).and_return(@config_env)
    @config_env.should_receive(:keys).and_return(['test'])

    SimpleDeploy::Misc::AttributeMerger.stub :new => @attribute_merger_mock

    merge_options = { :attributes   => [ { "attr1" => "val1" } ], 
                      :environment  => 'test',
                      :template     => '/tmp/test.json',
                      :input_stacks => ["stack1"] }
    @attribute_merger_mock.should_receive(:merge).with(merge_options).
                           and_return({ "attr1" => "val1",
                                        "attr2" => "val2" })
    @create = SimpleDeploy::CLI::Create.new
  end

  it "should create a stack with provided and merged attributes" do
    @stack_mock.should_receive(:create).
                with({ :attributes => { "attr1" => "val1",
                                        "attr2" => "val2" },
                       :template   => '/tmp/test.json' })
    @create.create
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
simple_deploy-0.7.6.beta.1 spec/cli/create_spec.rb
simple_deploy-0.7.5 spec/cli/create_spec.rb
simple_deploy-0.7.4 spec/cli/create_spec.rb
simple_deploy-0.7.3 spec/cli/create_spec.rb