Sha256: 440c2062b2f67b4593d2b796d6d62c2d1d0f43278c486dbf373b0b9c91239fc8

Contents?: true

Size: 1.89 KB

Versions: 4

Compression:

Stored size: 1.89 KB

Contents

require 'spec_helper'
require 'simple_deploy/cli'

describe SimpleDeploy::CLI::Outputs do

  before do
    @config_object = mock 'config'
    @config_env    = mock 'environment config'
    @stack         = mock 'stack'
    @logger        = stub 'logger'
    @options       = { :environment => 'test',
                       :log_level   => 'info',
                       :name        => 'mytest' }
    @data          = [{ 'OutputKey' => 'key1', 'OutputValue' => 'value1' },
                      { 'OutputKey' => 'key2', 'OutputValue' => 'value2' }]
    Trollop.stub :options => @options
    @config_object.stub(:environments => { 'test' => 'data' })
    SimpleDeploy::Config.stub :new => @config_object
    SimpleDeploy::SimpleDeployLogger.should_receive(:new).
                                     with(:log_level => 'info').
                                     and_return @logger
    SimpleDeploy::Stack.should_receive(:new).
                        with(:environment => 'test',
                             :name        => 'mytest',
                             :config      => @config_env,
                             :logger      => @logger).
                        and_return(@stack)
    @stack.stub :outputs => @data
    @config_object.should_receive(:environment).with('test').
                                                and_return @config_env
    @outputs = SimpleDeploy::CLI::Outputs.new
  end

  it "should successfully return the show command with default values" do
    @outputs.should_receive(:puts).with('key1: value1')
    @outputs.should_receive(:puts).with('key2: value2')
    @outputs.show
  end

  it "should successfully return the show command with as_command_args" do
    @options[:as_command_args] = true
    @outputs.should_receive(:print).with('-a key1=value1 ')
    @outputs.should_receive(:print).with('-a key2=value2 ')
    @outputs.should_receive(:puts).with('')
    @outputs.show
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
simple_deploy-0.7.2 spec/cli/outputs_spec.rb
simple_deploy-0.7.2.beta.1 spec/cli/outputs_spec.rb
simple_deploy-0.7.1 spec/cli/outputs_spec.rb
simple_deploy-0.7.0 spec/cli/outputs_spec.rb