summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authordanielsdeleo <dan@getchef.com>2014-04-23 16:00:10 -0700
committerdanielsdeleo <dan@getchef.com>2014-04-24 09:49:53 -0700
commitf3a436d4b20280e3bdfb4421b3ab97d9828cdff1 (patch)
treee6f858f378344ca2c13091c550979685c0bf59ea /spec
parentfdd3027dfe6043450ecde232e055df10099e003f (diff)
downloadchef-f3a436d4b20280e3bdfb4421b3ab97d9828cdff1.tar.gz
Supress stdout/err output from knife tests
Diffstat (limited to 'spec')
-rw-r--r--spec/unit/handler_spec.rb1
-rw-r--r--spec/unit/knife/client_bulk_delete_spec.rb3
-rw-r--r--spec/unit/knife/cookbook_bulk_delete_spec.rb2
-rw-r--r--spec/unit/knife/cookbook_site_install_spec.rb2
-rw-r--r--spec/unit/knife/user_create_spec.rb10
-rw-r--r--spec/unit/knife/user_edit_spec.rb5
6 files changed, 18 insertions, 5 deletions
diff --git a/spec/unit/handler_spec.rb b/spec/unit/handler_spec.rb
index 80d9df5e82..3a7e046dd5 100644
--- a/spec/unit/handler_spec.rb
+++ b/spec/unit/handler_spec.rb
@@ -107,7 +107,6 @@ describe Chef::Handler do
$report_ran = false
def @handler.report
$report_ran = true
- puts "I'm AOK here."
end
lambda {@handler.run_report_safely(@run_status)}.should_not raise_error
$report_ran.should be_true
diff --git a/spec/unit/knife/client_bulk_delete_spec.rb b/spec/unit/knife/client_bulk_delete_spec.rb
index 7df7d02e9b..d5cfda9885 100644
--- a/spec/unit/knife/client_bulk_delete_spec.rb
+++ b/spec/unit/knife/client_bulk_delete_spec.rb
@@ -21,12 +21,15 @@ require 'spec_helper'
describe Chef::Knife::ClientBulkDelete do
let(:stdout_io) { StringIO.new }
let(:stdout) {stdout_io.string}
+ let(:stderr_io) { StringIO.new }
+ let(:stderr) { stderr_io.string }
let(:knife) {
k = Chef::Knife::ClientBulkDelete.new
k.name_args = name_args
k.config = option_args
k.ui.stub(:stdout).and_return(stdout_io)
+ k.ui.stub(:stderr).and_return(stderr_io)
k.ui.stub(:confirm).and_return(knife_confirm)
k.ui.stub(:confirm_without_exit).and_return(knife_confirm)
k
diff --git a/spec/unit/knife/cookbook_bulk_delete_spec.rb b/spec/unit/knife/cookbook_bulk_delete_spec.rb
index 0cff690bc2..fb4b1d1484 100644
--- a/spec/unit/knife/cookbook_bulk_delete_spec.rb
+++ b/spec/unit/knife/cookbook_bulk_delete_spec.rb
@@ -27,7 +27,9 @@ describe Chef::Knife::CookbookBulkDelete do
@knife.config = {:print_after => nil}
@knife.name_args = ["."]
@stdout = StringIO.new
+ @stderr = StringIO.new
@knife.ui.stub(:stdout).and_return(@stdout)
+ @knife.ui.stub(:stderr).and_return(@stderr)
@knife.ui.stub(:confirm).and_return(true)
@cookbooks = Hash.new
%w{cheezburger pizza lasagna}.each do |cookbook_name|
diff --git a/spec/unit/knife/cookbook_site_install_spec.rb b/spec/unit/knife/cookbook_site_install_spec.rb
index c756380a80..ff87a81b49 100644
--- a/spec/unit/knife/cookbook_site_install_spec.rb
+++ b/spec/unit/knife/cookbook_site_install_spec.rb
@@ -21,7 +21,9 @@ require File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "spec_hel
describe Chef::Knife::CookbookSiteInstall do
before(:each) do
require 'chef/knife/core/cookbook_scm_repo'
+ @stdout = StringIO.new
@knife = Chef::Knife::CookbookSiteInstall.new
+ @knife.ui.stub(:stdout).and_return(@stdout)
@knife.config = {}
if Chef::Platform.windows?
@install_path = 'C:/tmp/chef'
diff --git a/spec/unit/knife/user_create_spec.rb b/spec/unit/knife/user_create_spec.rb
index cc803e99ce..039d4659b0 100644
--- a/spec/unit/knife/user_create_spec.rb
+++ b/spec/unit/knife/user_create_spec.rb
@@ -23,6 +23,12 @@ Chef::Knife::UserCreate.load_deps
describe Chef::Knife::UserCreate do
before(:each) do
@knife = Chef::Knife::UserCreate.new
+
+ @stdout = StringIO.new
+ @stderr = StringIO.new
+ @knife.ui.stub(:stdout).and_return(@stdout)
+ @knife.ui.stub(:stderr).and_return(@stderr)
+
@knife.name_args = [ 'a_user' ]
@knife.config[:user_password] = "foobar"
@user = Chef::User.new
@@ -34,10 +40,6 @@ describe Chef::Knife::UserCreate do
Chef::User.stub(:new).and_return(@user)
Chef::User.stub(:from_hash).and_return(@user)
@knife.stub(:edit_data).and_return(@user.to_hash)
- @stdout = StringIO.new
- @stderr = StringIO.new
- @knife.ui.stub(:stdout).and_return(@stdout)
- @knife.ui.stub(:stderr).and_return(@stderr)
end
it "creates a new user" do
diff --git a/spec/unit/knife/user_edit_spec.rb b/spec/unit/knife/user_edit_spec.rb
index d5b380a12f..20a4c0d9e9 100644
--- a/spec/unit/knife/user_edit_spec.rb
+++ b/spec/unit/knife/user_edit_spec.rb
@@ -20,8 +20,13 @@ require 'spec_helper'
describe Chef::Knife::UserEdit do
before(:each) do
+ @stderr = StringIO.new
+ @stdout = StringIO.new
+
Chef::Knife::UserEdit.load_deps
@knife = Chef::Knife::UserEdit.new
+ @knife.ui.stub(:stderr).and_return(@stderr)
+ @knife.ui.stub(:stdout).and_return(@stdout)
@knife.name_args = [ 'my_user' ]
@knife.config[:disable_editing] = true
end