summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel DeLeo <dan@opscode.com>2010-06-30 15:13:04 -0700
committerDaniel DeLeo <dan@opscode.com>2010-06-30 15:13:04 -0700
commita250ba4cf78ec517e6665519e3cbf401bf95e91c (patch)
treee703087aacde68f54be517ab13e12bf249692d2a
parent2ae853bd701673d6a9112ffa081d6bd3f940d952 (diff)
downloadchef-a250ba4cf78ec517e6665519e3cbf401bf95e91c.tar.gz
fix more broken method stubs/expectations, remove spurious debugging
-rw-r--r--chef/lib/chef/provider/group/dscl.rb1
-rw-r--r--chef/spec/unit/client_spec.rb3
-rw-r--r--chef/spec/unit/handler/json_file_spec.rb2
-rw-r--r--chef/spec/unit/lwrp_spec.rb6
-rw-r--r--chef/spec/unit/provider/group/dscl_spec.rb37
5 files changed, 5 insertions, 44 deletions
diff --git a/chef/lib/chef/provider/group/dscl.rb b/chef/lib/chef/provider/group/dscl.rb
index f37d2ce3bc..c6ef1d1ec0 100644
--- a/chef/lib/chef/provider/group/dscl.rb
+++ b/chef/lib/chef/provider/group/dscl.rb
@@ -73,7 +73,6 @@ class Chef
end
def set_members
- pp :set_members => {:append => @new_resource.append, :members => @new_resource.members}
unless @new_resource.append
Chef::Log.debug("#{@new_resource}: removing group members #{@current_resource.members.join(' ')}") unless @current_resource.members.empty?
safe_dscl("create /Groups/#{@new_resource.group_name} GroupMembers ''") # clear guid list
diff --git a/chef/spec/unit/client_spec.rb b/chef/spec/unit/client_spec.rb
index 379d99ab2d..2dd3df0063 100644
--- a/chef/spec/unit/client_spec.rb
+++ b/chef/spec/unit/client_spec.rb
@@ -88,6 +88,9 @@ describe Chef::Client, "run" do
Chef::Config.node_path(File.expand_path(File.join(CHEF_SPEC_DATA, "run_context", "nodes")))
Chef::Config.cookbook_path(File.expand_path(File.join(CHEF_SPEC_DATA, "run_context", "cookbooks")))
client = Chef::Client.new
+
+ client.node = node
+
client.stub!(:sync_cookbooks).and_return({})
client.run
diff --git a/chef/spec/unit/handler/json_file_spec.rb b/chef/spec/unit/handler/json_file_spec.rb
index 944ce392e9..7a1c112360 100644
--- a/chef/spec/unit/handler/json_file_spec.rb
+++ b/chef/spec/unit/handler/json_file_spec.rb
@@ -52,9 +52,7 @@ describe Chef::Handler::JsonFile do
it "saves run status data to a file as JSON" do
@handler.should_receive(:build_report_dir)
@handler.run_report_unsafe(@run_status)
- puts @run_status.exception
reported_data = JSON.parse(@file_mock.string)
- pp reported_data
reported_data['exception'].should == "Exception: Boy howdy!"
reported_data['start_time'].should == @expected_time.iso8601
reported_data['end_time'].should == (@expected_time + 5).iso8601
diff --git a/chef/spec/unit/lwrp_spec.rb b/chef/spec/unit/lwrp_spec.rb
index 7cb72d3f5e..606e9b01b1 100644
--- a/chef/spec/unit/lwrp_spec.rb
+++ b/chef/spec/unit/lwrp_spec.rb
@@ -136,8 +136,7 @@ describe "Light-weight Chef::Provider" do
res.provider(:lwrp_monkey_name_printer)
@run_context.resource_collection.insert(res)
- STDOUT.should_receive(:write).with("my monkey's name is 'bob'").exactly(:once)
- STDOUT.should_receive(:write).with("\n").exactly(:once)
+ STDOUT.should_receive(:puts).with("my monkey's name is 'bob'").exactly(:once)
Chef::Runner.new(@run_context).converge
end
@@ -148,8 +147,7 @@ describe "Light-weight Chef::Provider" do
res.provider(:lwrp_embedded_resource_accesses_providers_scope)
@run_context.resource_collection.insert(res)
- STDOUT.should_receive(:write).with("my monkey's name is 'bob, the monkey'").exactly(:once)
- STDOUT.should_receive(:write).with("\n").exactly(:once)
+ STDOUT.should_receive(:puts).with("my monkey's name is 'bob, the monkey'").exactly(:once)
Chef::Runner.new(@run_context).converge
end
diff --git a/chef/spec/unit/provider/group/dscl_spec.rb b/chef/spec/unit/provider/group/dscl_spec.rb
index 41a1dedb46..876dbb7f4b 100644
--- a/chef/spec/unit/provider/group/dscl_spec.rb
+++ b/chef/spec/unit/provider/group/dscl_spec.rb
@@ -148,20 +148,6 @@ describe Chef::Provider::Group::Dscl do
end
describe "set_gid" do
- # before do
- # @node = Chef::Node.new
- # @new_resource = mock("Chef::Resource::Group",
- # :null_object => true,
- # :group_name => "aj",
- # :gid => 50,
- # :members => [ "root", "aj"]
- # )
- # @provider = Chef::Provider::Group::Dscl.new(@node, @new_resource)
- # @provider.stub!(:get_free_gid).and_return(501)
- # @provider.stub!(:gid_used?).and_return(false)
- # @provider.stub!(:safe_dscl).and_return(true)
- # end
-
describe "with the new resource and a gid number which is already in use" do
before do
@provider.stub!(:gid_used?).and_return(true)
@@ -173,19 +159,6 @@ describe Chef::Provider::Group::Dscl do
end
describe "with no gid number for the new resources" do
- # before do
- # @new_resource = mock("Chef::Resource::Group",
- # :null_object => true,
- # :group_name => "aj",
- # :gid => nil,
- # :members => [ "root", "aj"]
- # )
- # @provider = Chef::Provider::Group::Dscl.new(@node, @new_resource)
- # @provider.stub!(:get_free_gid).and_return(501)
- # @provider.stub!(:gid_used?).and_return(false)
- # @provider.stub!(:safe_dscl).and_return(true)
- # end
-
it "should run get_free_gid and return a valid, unused gid number" do
@provider.should_receive(:get_free_gid).and_return(501)
@provider.set_gid
@@ -314,16 +287,6 @@ describe Chef::Provider::Group::Dscl do
end
describe "remove_group" do
- # before do
- # @node = Chef::Node.new
- # @new_resource = mock("Chef::Resource::Group",
- # :null_object => true,
- # :group_name => "aj"
- # )
- # @provider = Chef::Provider::Group::Dscl.new(@node, @new_resource)
- # @provider.stub!(:safe_dscl).and_return(true)
- # end
-
it "should run safe_dscl with delete /Groups/group and with the new resources group name" do
@provider.should_receive(:safe_dscl).with("delete /Groups/aj").and_return(true)
@provider.remove_group