Sha256: d4ce07cc0d5719b577920d6e054980816fc0defccbf9d6abb3a33cf6f2188c0e

Contents?: true

Size: 1.94 KB

Versions: 15

Compression:

Stored size: 1.94 KB

Contents

require 'spec_helper'
require 'json'

describe Stackster do

  before do
    @attributes = { "param1" => "value1", "param3" => "value3" }
    @template_json = '{ "Parameters": 
                        { 
                          "param1" : 
                            {
                              "Description" : "param-1"
                            },
                          "param2" : 
                            {
                              "Description" : "param-2"
                            }
                        }
                      }'
  end

  it "should map the attributes to a template's parameters and create a stack " do
    config_mock = mock 'config mock'
    logger_mock = mock 'logger mock'
    entry_mock = mock 'entry mock'
    file_mock = mock 'file mock'
    cloud_formation_mock = mock 'cloud formation mock'
    Stackster::AWS::CloudFormation.should_receive(:new).
                                   with(:config => config_mock).
                                   and_return cloud_formation_mock
    File.should_receive(:open).with('path_to_file').
                               and_return file_mock
    file_mock.should_receive(:read).and_return @template_json
    config_mock.should_receive(:logger).and_return(logger_mock)
    logger_mock.should_receive(:info).exactly(1).times
    entry_mock.should_receive(:attributes).and_return @attributes
    cloud_formation_mock.should_receive(:create).
                         with(:name      => 'test-stack', 
                              :parameters => { 'param1' => 'value1' },
                              :template   => @template_json)
    stack_creater = Stackster::StackCreater.new :name          => 'test-stack',
                                                :template_file => 'path_to_file',
                                                :entry         => entry_mock,
                                                :config        => config_mock

    stack_creater.create
  end

end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
stackster-0.4.4 spec/stack/stack_creater_spec.rb
stackster-0.4.3 spec/stack/stack_creater_spec.rb
stackster-0.4.2 spec/stack/stack_creater_spec.rb
stackster-0.4.1 spec/stack/stack_creater_spec.rb
stackster-0.4.0 spec/stack/stack_creater_spec.rb
stackster-0.3.2 spec/stack/stack_creater_spec.rb
stackster-0.3.1 spec/stack/stack_creater_spec.rb
stackster-0.3.0 spec/stack/stack_creater_spec.rb
stackster-0.2.9 spec/stack/stack_creater_spec.rb
stackster-0.2.8 spec/stack/stack_creater_spec.rb
stackster-0.2.7 spec/stack/stack_creater_spec.rb
stackster-0.2.6 spec/stack/stack_creater_spec.rb
stackster-0.2.5 spec/stack/stack_creater_spec.rb
stackster-0.2.4 spec/stack/stack_creater_spec.rb
stackster-0.2.3 spec/stack/stack_creater_spec.rb