summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJay Mundrawala <jdmundrawala@gmail.com>2014-12-13 19:12:42 -0800
committerJay Mundrawala <jdmundrawala@gmail.com>2014-12-14 09:29:23 -0800
commit6595609fa3331111a28d0833242f37e77ec5f3e9 (patch)
tree4d35bc0a7b9a13c5df0ad6caa82cd8d9e25208f0
parenta0c7548274334beeeab4bce6e37e176e232d267e (diff)
downloadchef-jdm/shellout-spec.tar.gz
Renamed dummy_obj to shell_out_objjdm/shellout-spec
-rw-r--r--spec/unit/mixin/shell_out_spec.rb78
1 files changed, 39 insertions, 39 deletions
diff --git a/spec/unit/mixin/shell_out_spec.rb b/spec/unit/mixin/shell_out_spec.rb
index c39780b284..3dc9d42574 100644
--- a/spec/unit/mixin/shell_out_spec.rb
+++ b/spec/unit/mixin/shell_out_spec.rb
@@ -23,10 +23,10 @@
require 'spec_helper'
describe Chef::Mixin::ShellOut do
- let(:dummy_class) { Class.new { include Chef::Mixin::ShellOut } }
- subject(:dummy_obj) { dummy_class.new }
+ let(:shell_out_class) { Class.new { include Chef::Mixin::ShellOut } }
+ subject(:shell_out_obj) { shell_out_class.new }
describe '#run_command_compatible_options' do
- subject { dummy_obj.run_command_compatible_options(command_args) }
+ subject { shell_out_obj.run_command_compatible_options(command_args) }
let(:command_args) { [ cmd, options ] }
let(:cmd) { "echo '#{rand(1000)}'" }
@@ -125,30 +125,30 @@ describe Chef::Mixin::ShellOut do
describe "and environment is an option" do
it "should not change environment['LC_ALL'] when set to nil" do
options = { :environment => { 'LC_ALL' => nil } }
- expect(dummy_obj).to receive(:shell_out_command).with(cmd, options).and_return(true)
- dummy_obj.shell_out(cmd, options)
+ expect(shell_out_obj).to receive(:shell_out_command).with(cmd, options).and_return(true)
+ shell_out_obj.shell_out(cmd, options)
end
it "should not change environment['LC_ALL'] when set to non-nil" do
options = { :environment => { 'LC_ALL' => 'en_US.UTF-8' } }
- expect(dummy_obj).to receive(:shell_out_command).with(cmd, options).and_return(true)
- dummy_obj.shell_out(cmd, options)
+ expect(shell_out_obj).to receive(:shell_out_command).with(cmd, options).and_return(true)
+ shell_out_obj.shell_out(cmd, options)
end
it "should set environment['LC_ALL'] to 'en_US.UTF-8' when 'LC_ALL' not present" do
options = { :environment => { 'HOME' => '/Users/morty' } }
- expect(dummy_obj).to receive(:shell_out_command).with(cmd, {
+ expect(shell_out_obj).to receive(:shell_out_command).with(cmd, {
:environment => { 'HOME' => '/Users/morty', 'LC_ALL' => Chef::Config[:internal_locale] },
}).and_return(true)
- dummy_obj.shell_out(cmd, options)
+ shell_out_obj.shell_out(cmd, options)
end
it "should not mutate the options hash when it adds LC_ALL" do
options = { :environment => { 'HOME' => '/Users/morty' } }
- expect(dummy_obj).to receive(:shell_out_command).with(cmd, {
+ expect(shell_out_obj).to receive(:shell_out_command).with(cmd, {
:environment => { 'HOME' => '/Users/morty', 'LC_ALL' => Chef::Config[:internal_locale] },
}).and_return(true)
- dummy_obj.shell_out(cmd, options)
+ shell_out_obj.shell_out(cmd, options)
expect(options[:environment].has_key?('LC_ALL')).to be false
end
end
@@ -156,30 +156,30 @@ describe Chef::Mixin::ShellOut do
describe "and env is an option" do
it "should not change env when set to nil" do
options = { :env => { 'LC_ALL' => nil } }
- expect(dummy_obj).to receive(:shell_out_command).with(cmd, options).and_return(true)
- dummy_obj.shell_out(cmd, options)
+ expect(shell_out_obj).to receive(:shell_out_command).with(cmd, options).and_return(true)
+ shell_out_obj.shell_out(cmd, options)
end
it "should not change env when set to non-nil" do
options = { :env => { 'LC_ALL' => 'de_DE.UTF-8'}}
- expect(dummy_obj).to receive(:shell_out_command).with(cmd, options).and_return(true)
- dummy_obj.shell_out(cmd, options)
+ expect(shell_out_obj).to receive(:shell_out_command).with(cmd, options).and_return(true)
+ shell_out_obj.shell_out(cmd, options)
end
it "should set env['LC_ALL'] to 'en_US.UTF-8' when 'LC_ALL' not present" do
options = { :env => { 'HOME' => '/Users/morty' } }
- expect(dummy_obj).to receive(:shell_out_command).with(cmd, {
+ expect(shell_out_obj).to receive(:shell_out_command).with(cmd, {
:env => { 'HOME' => '/Users/morty', 'LC_ALL' => Chef::Config[:internal_locale] },
}).and_return(true)
- dummy_obj.shell_out(cmd, options)
+ shell_out_obj.shell_out(cmd, options)
end
it "should not mutate the options hash when it adds LC_ALL" do
options = { :env => { 'HOME' => '/Users/morty' } }
- expect(dummy_obj).to receive(:shell_out_command).with(cmd, {
+ expect(shell_out_obj).to receive(:shell_out_command).with(cmd, {
:env => { 'HOME' => '/Users/morty', 'LC_ALL' => Chef::Config[:internal_locale] },
}).and_return(true)
- dummy_obj.shell_out(cmd, options)
+ shell_out_obj.shell_out(cmd, options)
expect(options[:env].has_key?('LC_ALL')).to be false
end
end
@@ -187,20 +187,20 @@ describe Chef::Mixin::ShellOut do
describe "and no env/environment option is present" do
it "should add environment option and set environment['LC_ALL'] to 'en_US.UTF_8'" do
options = { :user => 'morty' }
- expect(dummy_obj).to receive(:shell_out_command).with(cmd, {
+ expect(shell_out_obj).to receive(:shell_out_command).with(cmd, {
:user => 'morty', :environment => { 'LC_ALL' => Chef::Config[:internal_locale] },
}).and_return(true)
- dummy_obj.shell_out(cmd, options)
+ shell_out_obj.shell_out(cmd, options)
end
end
end
describe "when the last argument is not a Hash" do
it "should add environment options and set environment['LC_ALL'] to 'en_US.UTF-8'" do
- expect(dummy_obj).to receive(:shell_out_command).with(cmd, {
+ expect(shell_out_obj).to receive(:shell_out_command).with(cmd, {
:environment => { 'LC_ALL' => Chef::Config[:internal_locale] },
}).and_return(true)
- dummy_obj.shell_out(cmd)
+ shell_out_obj.shell_out(cmd)
end
end
@@ -212,56 +212,56 @@ describe Chef::Mixin::ShellOut do
describe "and environment is an option" do
it "should not change environment['LC_ALL'] when set to nil" do
options = { :environment => { 'LC_ALL' => nil } }
- expect(dummy_obj).to receive(:shell_out_command).with(cmd, options).and_return(true)
- dummy_obj.shell_out_with_systems_locale(cmd, options)
+ expect(shell_out_obj).to receive(:shell_out_command).with(cmd, options).and_return(true)
+ shell_out_obj.shell_out_with_systems_locale(cmd, options)
end
it "should not change environment['LC_ALL'] when set to non-nil" do
options = { :environment => { 'LC_ALL' => 'en_US.UTF-8' } }
- expect(dummy_obj).to receive(:shell_out_command).with(cmd, options).and_return(true)
- dummy_obj.shell_out_with_systems_locale(cmd, options)
+ expect(shell_out_obj).to receive(:shell_out_command).with(cmd, options).and_return(true)
+ shell_out_obj.shell_out_with_systems_locale(cmd, options)
end
it "should no longer set environment['LC_ALL'] to nil when 'LC_ALL' not present" do
options = { :environment => { 'HOME' => '/Users/morty' } }
- expect(dummy_obj).to receive(:shell_out_command).with(cmd, options).and_return(true)
- dummy_obj.shell_out_with_systems_locale(cmd, options)
+ expect(shell_out_obj).to receive(:shell_out_command).with(cmd, options).and_return(true)
+ shell_out_obj.shell_out_with_systems_locale(cmd, options)
end
end
describe "and env is an option" do
it "should not change env when set to nil" do
options = { :env => { 'LC_ALL' => nil } }
- expect(dummy_obj).to receive(:shell_out_command).with(cmd, options).and_return(true)
- dummy_obj.shell_out_with_systems_locale(cmd, options)
+ expect(shell_out_obj).to receive(:shell_out_command).with(cmd, options).and_return(true)
+ shell_out_obj.shell_out_with_systems_locale(cmd, options)
end
it "should not change env when set to non-nil" do
options = { :env => { 'LC_ALL' => 'en_US.UTF-8'}}
- expect(dummy_obj).to receive(:shell_out_command).with(cmd, options).and_return(true)
- dummy_obj.shell_out_with_systems_locale(cmd, options)
+ expect(shell_out_obj).to receive(:shell_out_command).with(cmd, options).and_return(true)
+ shell_out_obj.shell_out_with_systems_locale(cmd, options)
end
it "should no longer set env['LC_ALL'] to nil when 'LC_ALL' not present" do
options = { :env => { 'HOME' => '/Users/morty' } }
- expect(dummy_obj).to receive(:shell_out_command).with(cmd, options).and_return(true)
- dummy_obj.shell_out_with_systems_locale(cmd, options)
+ expect(shell_out_obj).to receive(:shell_out_command).with(cmd, options).and_return(true)
+ shell_out_obj.shell_out_with_systems_locale(cmd, options)
end
end
describe "and no env/environment option is present" do
it "should no longer add environment option and set environment['LC_ALL'] to nil" do
options = { :user => 'morty' }
- expect(dummy_obj).to receive(:shell_out_command).with(cmd, options).and_return(true)
- dummy_obj.shell_out_with_systems_locale(cmd, options)
+ expect(shell_out_obj).to receive(:shell_out_command).with(cmd, options).and_return(true)
+ shell_out_obj.shell_out_with_systems_locale(cmd, options)
end
end
end
describe "when the last argument is not a Hash" do
it "should no longer add environment options and set environment['LC_ALL'] to nil" do
- expect(dummy_obj).to receive(:shell_out_command).with(cmd).and_return(true)
- dummy_obj.shell_out_with_systems_locale(cmd)
+ expect(shell_out_obj).to receive(:shell_out_command).with(cmd).and_return(true)
+ shell_out_obj.shell_out_with_systems_locale(cmd)
end
end
end