Sha256: 579701a982f8d995cb11b123bae8d1b35e2b68da4c30a5975a6ef0f29dff1a67

Contents?: true

Size: 1.4 KB

Versions: 18

Compression:

Stored size: 1.4 KB

Contents

require 'spec_helper'
require 'simple_deploy/cli'

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

  describe 'show' do
    before do
      @options = { :environment => 'my_env',
                   :log_level   => 'debug',
                   :name        => 'my_stack' }
      @stack_stub.stub(:attributes).and_return({ 'foo' => 'bar', 'baz' => 'blah' })
    end

    it 'should output the attributes' do
      subject.should_receive(:valid_options?).
              with(:provided => @options,
                   :required => [:environment, :name])
      Trollop.stub(:options).and_return(@options)
      subject.should_receive(:puts).with('foo: bar')
      subject.should_receive(:puts).with('baz: blah')
      subject.show
    end

    context 'with --as-command-args' do
      before do
        @options[:as_command_args] = true
        Trollop.stub(:options).and_return(@options)
        subject.should_receive(:valid_options?).
                with(:provided => @options,
                     :required => [:environment, :name])
      end

      it 'should output the attributes as command arguments' do
        subject.should_receive(:puts).with("-a baz=blah -a foo=bar")
        subject.show
      end
    end

  end

end

Version data entries

18 entries across 18 versions & 1 rubygems

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