spec/command_spec.rb in rconf-0.8.21 vs spec/command_spec.rb in rconf-0.8.29
- old
+ new
@@ -1,6 +1,6 @@
-# Copyright (C) 2011 RightScale, Inc, All Rights Reserved Worldwide.
+# Copyright (C) 2011-2012 RightScale, Inc, All Rights Reserved Worldwide.
#
# THIS PROGRAM IS CONFIDENTIAL AND PROPRIETARY TO RIGHTSCALE
# AND CONSTITUTES A VALUABLE TRADE SECRET. Any unauthorized use,
# reproduction, modification, or disclosure of this program is
# strictly prohibited. Any use of this program by an authorized
@@ -20,18 +20,25 @@
def failed_result
RightConf::CommandResult.new(1, '')
end
it 'should execute' do
- flexmock(RightConf::Platform.instance).should_receive(:dispatch).with('test', '42', Proc).once.and_return(success_result)
+ flexmock(RightConf::Platform.instance).should_receive(:dispatch).with('test', nil, '42', Proc).once.and_return(success_result)
RightConf::Command.execute('test', '42')
end
it 'should report fatal errors when required to' do
- flexmock(RightConf::Platform.instance).should_receive(:dispatch).with('test', '42',
+ flexmock(RightConf::Platform.instance).should_receive(:dispatch).with('test', nil, '42',
Proc).once.and_return(failed_result)
flexmock(RightConf::Command.instance).should_receive(:report_fatal).once.with("FAILED: 'test 42' returned\n1")
RightConf::Command.execute('test', '42', :abort_on_failure => 'FAILED')
+ end
+
+ it 'should setup environment variables' do
+ ENV['THIS_IS_A_TEST_ENV_VALUE'].should be_nil
+ res = RightConf::Command.execute('env', :env => { 'THIS_IS_A_TEST_ENV_VALUE' => '42' })
+ ENV['THIS_IS_A_TEST_ENV_VALUE'].should be_nil
+ res.output.should =~ /^THIS_IS_A_TEST_ENV_VALUE=42$/
end
end