diff options
author | Bryan McLellan <btm@getchef.com> | 2014-09-29 17:51:24 -0700 |
---|---|---|
committer | Bryan McLellan <btm@getchef.com> | 2014-09-29 17:51:24 -0700 |
commit | 08be0f5941ea7d120e717b1db93c21d477457e22 (patch) | |
tree | db8c954b0cd5efc0549dcc8bef9615d3e6501d64 | |
parent | 582bec42aa1a5feb9693f72102b77b2fe468f092 (diff) | |
download | chef-08be0f5941ea7d120e717b1db93c21d477457e22.tar.gz |
Match group func tests to specification
When a group does not exist, the group resource should raise an exception on action modify,
but not on action_manage.
Also update the `not_to raise_error(SpecificError)` deprecated syntax.
-rw-r--r-- | spec/functional/resource/group_spec.rb | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/spec/functional/resource/group_spec.rb b/spec/functional/resource/group_spec.rb index 3c97291294..d88fb64386 100644 --- a/spec/functional/resource/group_spec.rb +++ b/spec/functional/resource/group_spec.rb @@ -28,10 +28,10 @@ describe Chef::Resource::Group, :requires_root_or_running_windows, :not_supporte def group_should_exist(group) case ohai[:platform_family] when "debian", "fedora", "rhel", "suse", "gentoo", "slackware", "arch" - expect { Etc::getgrnam(group) }.to_not raise_error(ArgumentError, "can't find group for #{group}") + expect { Etc::getgrnam(group) }.not_to raise_error expect(group).to eq(Etc::getgrnam(group).name) when "windows" - expect { Chef::Util::Windows::NetGroup.new(group).local_get_members }.to_not raise_error(ArgumentError, "The group name could not be found.") + expect { Chef::Util::Windows::NetGroup.new(group).local_get_members }.not_to raise_error end end @@ -369,9 +369,14 @@ downthestreetalwayshadagoodsmileonhisfacetheoldmanwalkingdownthestreeQQQQQQ" } let(:tested_action) { :manage } describe "when there is no group" do - it "should raise an error" do + it "raises an error on modify" do + lambda { group_resource.run_action(:modify) }.should raise_error + #group_should_not_exist(group_name) + end + + it "does not raise an error on manage" do lambda { group_resource.run_action(:manage) }.should_not raise_error - group_should_not_exist(group_name) + #group_should_not_exist(group_name) end end |