summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjmink <jmink@getchef.com>2014-06-26 14:49:34 -0400
committerjmink <jmink@getchef.com>2014-06-26 15:06:59 -0400
commitf6ad81f40d7e31f9227fa2996d1f7025b7e8dc1a (patch)
tree5c804bc5d6573081678db6ad795af7d8cdf678de
parent19214168200e52538b285c99c7bf86f3f8b2003b (diff)
downloadchef-f6ad81f40d7e31f9227fa2996d1f7025b7e8dc1a.tar.gz
Fix cookbook_site_share tests
-rw-r--r--lib/chef/knife/cookbook_site_share.rb4
-rw-r--r--spec/unit/knife/cookbook_site_share_spec.rb10
2 files changed, 6 insertions, 8 deletions
diff --git a/lib/chef/knife/cookbook_site_share.rb b/lib/chef/knife/cookbook_site_share.rb
index 4dcce42d7f..cf0d3b8eac 100644
--- a/lib/chef/knife/cookbook_site_share.rb
+++ b/lib/chef/knife/cookbook_site_share.rb
@@ -23,8 +23,6 @@ class Chef
class Knife
class CookbookSiteShare < Knife
- include Chef::Mixin::ShellOut
-
deps do
require 'chef/cookbook_loader'
require 'chef/cookbook_uploader'
@@ -59,7 +57,7 @@ class Chef
begin
Chef::Log.debug("Temp cookbook directory is #{tmp_cookbook_dir.inspect}")
ui.info("Making tarball #{cookbook_name}.tgz")
- shell_out!("tar -czf #{cookbook_name}.tgz #{cookbook_name}", :cwd => tmp_cookbook_dir)
+ Chef::Mixin::ShellOut::shell_out!("tar -czf #{cookbook_name}.tgz #{cookbook_name}", :cwd => tmp_cookbook_dir)
rescue => e
ui.error("Error making tarball #{cookbook_name}.tgz: #{e.message}. Increase log verbosity (-VV) for more information.")
Chef::Log.debug("\n#{e.backtrace.join("\n")}")
diff --git a/spec/unit/knife/cookbook_site_share_spec.rb b/spec/unit/knife/cookbook_site_share_spec.rb
index 14c4262cb3..b1930f2d2c 100644
--- a/spec/unit/knife/cookbook_site_share_spec.rb
+++ b/spec/unit/knife/cookbook_site_share_spec.rb
@@ -39,7 +39,7 @@ describe Chef::Knife::CookbookSiteShare do
@cookbook_uploader.stub(:validate_cookbooks).and_return(true)
Chef::CookbookSiteStreamingUploader.stub(:create_build_dir).and_return(Dir.mktmpdir)
- Chef::Mixin::Command.stub(:run_command).and_return(true)
+ Chef::Mixin::ShellOut.stub(:shell_out!).and_return(true)
@stdout = StringIO.new
@knife.ui.stub(:stdout).and_return(@stdout)
end
@@ -76,14 +76,14 @@ describe Chef::Knife::CookbookSiteShare do
end
it 'should make a tarball of the cookbook' do
- Chef::Mixin::Command.should_receive(:run_command) { |args|
- args[:command].should match /tar -czf/
- }
+ Chef::Mixin::ShellOut.should_receive(:shell_out!) do |args|
+ args.should match /tar -czf/
+ end
@knife.run
end
it 'should exit and log to error when the tarball creation fails' do
- Chef::Mixin::Command.stub(:run_command).and_raise(Chef::Exceptions::Exec)
+ Chef::Mixin::ShellOut.stub(:shell_out!).and_raise(Chef::Exceptions::Exec)
@knife.ui.should_receive(:error)
lambda { @knife.run }.should raise_error(SystemExit)
end