Sha256: 209c2f4af14b6f481b358821a4a3b57c51365697caca16cbcabffc96696bb168

Contents?: true

Size: 664 Bytes

Versions: 5

Compression:

Stored size: 664 Bytes

Contents

require_relative 'helper'

describe 'CfnFlow::CLI' do
  let(:cli) { CfnFlow::CLI }

  before do
    ENV.update({
      'CFN_FLOW_BUCKET' => 'test-bucket',
      'CFN_FLOW_FROM' => 'spec/data',
      'CFN_FLOW_TO'   => 'test'
    })
  end

  describe '#validate' do
    it('succeeds') {
      capture { cli.start %w[validate] }
    }

    it('can fail') {
      (Thread.current[:aws_cfn_client] = Aws::CloudFormation::Client.new).
      stub_responses(:validate_template, 'ValidationError')

      out = capture(:stderr) { cli.start %w(validate) }

      Thread.current[:aws_cfn_client] = nil
      out.include?("Error validating").must_equal true
    }
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
cfn-flow-0.2.1 spec/cfn-flow_cli_spec.rb
cfn-flow-0.2.0 spec/cfn-flow_cli_spec.rb
cfn-flow-0.1.2 spec/cfn-flow_cli_spec.rb
cfn-flow-0.1.1 spec/cfn-flow_cli_spec.rb
cfn-flow-0.1.0 spec/cfn-flow_cli_spec.rb