Sha256: 2f729ac1627584e6b4e1c67fdffd14cd8aa56ef28f37d63497d6b94407be4333

Contents?: true

Size: 1.37 KB

Versions: 3

Compression:

Stored size: 1.37 KB

Contents

require 'spec_helper'

describe Stackster do
  before do
    #@logger_stub = stub 'logger stub', :info => 'true', :warn => 'true'
    @logger_mock = mock 'Logger'
    @config_stub = stub 'Config', :logger => @logger_mock, :access_key => 'key', :secret_key => 'XXX', :region => 'us-west1'

    @exception_stub1 = stub 'Excon::Response'
    @exception_stub1.stub(:response).and_return(@exception_stub1)
    @exception_stub1.stub(:body).and_return('<opt><Error><Message>No updates are to be performed.</Message></Error></opt>')

    @exception_stub2 = stub 'Excon::Response'
    @exception_stub2.stub(:response).and_return(@exception_stub2)
    @exception_stub2.stub(:body).and_return('<opt><Error><Message>Oops.</Message></Error></opt>')
  end

  describe 'process' do
    it 'should process no update messages' do
      @logger_mock.should_receive(:info).with('No updates are to be performed.')

      error = Stackster::AWS::CloudFormation::Error.new :exception => @exception_stub1, :config => @config_stub
      error.process
    end

    it 'should process general messages' do
      @logger_mock.should_receive(:error).with('Oops.')

      error = Stackster::AWS::CloudFormation::Error.new :exception => @exception_stub2, :config => @config_stub

      begin
        error.process
        fail 'should have exited'
      rescue SystemExit => e
        e.status.should == 1
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
stackster-0.3.2 spec/aws/cloud_formation/error_spec.rb
stackster-0.3.1 spec/aws/cloud_formation/error_spec.rb
stackster-0.3.0 spec/aws/cloud_formation/error_spec.rb