Sha256: bf9dfa05c9ed1f284542e98a812709d52f69e5d088b3f7f313e943895e8e5563

Contents?: true

Size: 1.85 KB

Versions: 17

Compression:

Stored size: 1.85 KB

Contents

require 'spec_helper'
require 'simple_deploy/cli'

describe SimpleDeploy::CLI::Update do
  include_context 'cli config'
  include_context 'double stubbed logger'
  include_context 'received stack array', 'my_stack', 'my_env', 1

  describe 'update' do
    before do
      @stack_mock1.stub(:attributes).and_return({})
      @template_body = "{ \"fake_json\" : \"goodness\"}"

      @options = { :environment => 'my_env',
                   :log_level   => 'debug',
                   :name        => ['my_stack1'],
                   :force       => true,
                   :attributes  => ['chef_repo_bucket_prefix=intu-lc'] }

    end

    it "should pass force true" do
      subject.should_receive(:valid_options?).
              with(:provided => @options,
                   :required => [:environment, :name])

      Trollop.stub(:options).and_return(@options)

      @stack_mock1.should_receive(:update).with(hash_including(:force => true))

      subject.update
    end

    it "should pass force false" do
      @options[:force] = false

      subject.should_receive(:valid_options?).
              with(:provided => @options,
                   :required => [:environment, :name])

      Trollop.stub(:options).and_return(@options)

      @stack_mock1.should_receive(:update).with(hash_including(:force => false))

      subject.update
    end

    it "should update the template if a new template is provided" do
      @options[:template] = 'brand_new_template.json'

      subject.should_receive(:valid_options?).
        with(:provided => @options,
             :required => [:environment, :name])

      Trollop.stub(:options).and_return(@options)

      IO.should_receive(:read).with('brand_new_template.json').and_return(@template_body)

      @stack_mock1.should_receive(:update).with(hash_including(:template_body => @template_body))
      subject.update
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
simple_deploy-0.9.2 spec/cli/update_spec.rb
simple_deploy-0.9.1 spec/cli/update_spec.rb
simple_deploy-0.9.0 spec/cli/update_spec.rb
simple_deploy-0.8.2 spec/cli/update_spec.rb
simple_deploy-0.8.2.beta1 spec/cli/update_spec.rb
simple_deploy-0.8.1.beta1 spec/cli/update_spec.rb
simple_deploy-0.8.0 spec/cli/update_spec.rb
simple_deploy-0.7.8 spec/cli/update_spec.rb
simple_deploy-0.7.7 spec/cli/update_spec.rb
simple_deploy-0.7.7.beta.1 spec/cli/update_spec.rb
simple_deploy-0.7.6 spec/cli/update_spec.rb
simple_deploy-0.7.6.beta.6 spec/cli/update_spec.rb
simple_deploy-0.7.6.beta.5 spec/cli/update_spec.rb
simple_deploy-0.7.6.beta.3 spec/cli/update_spec.rb
simple_deploy-0.7.6.beta.1 spec/cli/update_spec.rb
simple_deploy-0.7.5 spec/cli/update_spec.rb
simple_deploy-0.7.4 spec/cli/update_spec.rb