spec/cli/outputs_spec.rb in simple_deploy-0.7.2 vs spec/cli/outputs_spec.rb in simple_deploy-0.7.3

- old
+ new

@@ -1,35 +1,30 @@ require 'spec_helper' require 'simple_deploy/cli' describe SimpleDeploy::CLI::Outputs do + include_context 'cli config' + include_context 'double stubbed logger' + include_context 'stubbed stack', :name => 'mytest', + :environment => 'test' 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 + @config_mock.stub(:environments => { 'test' => 'data' }) + SimpleDeploy.stub(:environments).and_return(@config_env) + @config_env.should_receive(:keys).and_return(['test']) + @stack_mock.stub(:outputs).and_return(@data) @outputs = SimpleDeploy::CLI::Outputs.new + end + + after do + SimpleDeploy.release_config 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')