spec/cli/attributes_spec.rb in simple_deploy-0.9.2 vs spec/cli/attributes_spec.rb in simple_deploy-0.10.0.beta.1
- old
+ new
@@ -5,10 +5,30 @@
include_context 'cli config'
include_context 'double stubbed logger'
include_context 'double stubbed stack', :name => 'my_stack',
:environment => 'my_env'
+ describe 'with --read-from-env' do
+ before do
+ @options = { :environment => nil,
+ :log_level => 'debug',
+ :name => 'my_stack',
+ :read_from_env => true }
+ @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, :read_from_env])
+ Trollop.stub(:options).and_return(@options)
+ subject.should_receive(:puts).with('foo: bar')
+ subject.should_receive(:puts).with('baz: blah')
+ subject.show
+ end
+ end
+
describe 'show' do
before do
@options = { :environment => 'my_env',
:log_level => 'debug',
:name => 'my_stack' }
@@ -16,11 +36,11 @@
end
it 'should output the attributes' do
subject.should_receive(:valid_options?).
with(:provided => @options,
- :required => [:environment, :name])
+ :required => [:environment, :name, :read_from_env])
Trollop.stub(:options).and_return(@options)
subject.should_receive(:puts).with('foo: bar')
subject.should_receive(:puts).with('baz: blah')
subject.show
end
@@ -29,10 +49,10 @@
before do
@options[:as_command_args] = true
Trollop.stub(:options).and_return(@options)
subject.should_receive(:valid_options?).
with(:provided => @options,
- :required => [:environment, :name])
+ :required => [:environment, :name, :read_from_env])
end
it 'should output the attributes as command arguments' do
subject.should_receive(:puts).with("-a baz=blah -a foo=bar")
subject.show