diff options
author | Adam Edwards <adamed@opscode.com> | 2014-03-28 00:13:42 -0700 |
---|---|---|
committer | Adam Edwards <adamed@opscode.com> | 2014-03-29 00:21:10 -0700 |
commit | b57795c468a366ff8d755e22f1364c10a5d27af9 (patch) | |
tree | 874a6ee7b89d17d0f4c40bece399ff538e98c850 /spec/unit | |
parent | a8e083a2503c5c81d944f584921628981bad8f9e (diff) | |
download | chef-b57795c468a366ff8d755e22f1364c10a5d27af9.tar.gz |
CR feedback: use expect to explicitly test exception behavior
Diffstat (limited to 'spec/unit')
-rw-r--r-- | spec/unit/resource/conditional/guard_interpreter_spec.rb | 6 | ||||
-rw-r--r-- | spec/unit/resource_spec.rb | 10 |
2 files changed, 3 insertions, 13 deletions
diff --git a/spec/unit/resource/conditional/guard_interpreter_spec.rb b/spec/unit/resource/conditional/guard_interpreter_spec.rb index 3cf64b98a0..3f49e341dc 100644 --- a/spec/unit/resource/conditional/guard_interpreter_spec.rb +++ b/spec/unit/resource/conditional/guard_interpreter_spec.rb @@ -49,11 +49,7 @@ describe Chef::Resource::Conditional::GuardInterpreter do it "should raise an exception if guard_interpreter is set to a resource not derived from Chef::Resource::Script" do resource.guard_interpreter(:file) - - begin - resource.only_if("echo hi").should raise_error ArgumentError - rescue ArgumentError - end + expect { resource.only_if("echo hi") }.to raise_error ArgumentError end end end diff --git a/spec/unit/resource_spec.rb b/spec/unit/resource_spec.rb index 911d234d1d..734d92db42 100644 --- a/spec/unit/resource_spec.rb +++ b/spec/unit/resource_spec.rb @@ -534,17 +534,11 @@ describe Chef::Resource do end it "should raise Chef::Exceptions::ValidationFailed on an attempt to set the guard_interpreter attribute to something other than a Symbol" do - begin - resource.guard_interpreter('command_dot_com') - rescue Chef::Exceptions::ValidationFailed - end + expect { resource.guard_interpreter('command_dot_com') }.to raise_error(Chef::Exceptions::ValidationFailed) end it "should not raise an exception when setting the guard interpreter attribute to a Symbol" do - begin - resource.guard_interpreter(:command_dot_com) - rescue Chef::Exceptions::ValidationFailed - end + expect { resource.guard_interpreter(:command_dot_com) }.not_to raise_error end end |