Sha256: 83d672cd548b176e491f125bc4903478d3c2c94f20fa825c569cb4f5578c352d

Contents?: true

Size: 1.3 KB

Versions: 18

Compression:

Stored size: 1.3 KB

Contents

require 'spec_helper'
require 'simple_deploy/cli'

describe SimpleDeploy::CLI::Destroy do
  include_context 'cli config'
  include_context 'double stubbed logger'
  include_context 'stubbed stack', :name        => 'my_stack',
                                   :environment => 'my_env'

  describe 'destroy' do
    before do
      @options = { :environment => 'my_env',
                   :log_level   => 'debug',
                   :name        => 'my_stack' }
      @stack_mock.stub(:attributes).and_return({})
    end

    it "should exit with 0" do
      subject.should_receive(:valid_options?).
              with(:provided => @options,
                   :required => [:environment, :name])
      Trollop.stub(:options).and_return(@options)

      @stack_mock.should_receive(:destroy).and_return(true)

      begin
        subject.destroy
      rescue SystemExit => e
        e.status.should == 0
      end
    end

    it "should exit with 1" do
      subject.should_receive(:valid_options?).
              with(:provided => @options,
                   :required => [:environment, :name])
      Trollop.stub(:options).and_return(@options)

      @stack_mock.should_receive(:destroy).and_return(false)

      begin
        subject.destroy
      rescue SystemExit => e
        e.status.should == 1
      end
    end
  end 
end

Version data entries

18 entries across 18 versions & 1 rubygems

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