diff options
author | Igor Shpakov <igorshp@gmail.com> | 2015-04-09 15:42:03 +0100 |
---|---|---|
committer | Igor Shpakov <igorshp@gmail.com> | 2015-04-09 15:42:03 +0100 |
commit | cd21b8c4f46678e01beb13100b1413a813f87d26 (patch) | |
tree | 317be70127fe70829d824a4bf058310cd8d9d76f | |
parent | 8f971a1c5e7a1095798aee6874aecc42047d37ab (diff) | |
download | chef-cd21b8c4f46678e01beb13100b1413a813f87d26.tar.gz |
added rspec test
testing early fail inside 'run#begin' block.
-rw-r--r-- | spec/unit/client_spec.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/unit/client_spec.rb b/spec/unit/client_spec.rb index fa8317744c..cef8f970bc 100644 --- a/spec/unit/client_spec.rb +++ b/spec/unit/client_spec.rb @@ -819,4 +819,24 @@ describe Chef::Client do end end + + describe "should always attempt to run handlers" do + let(:e) { NoMethodError } + subject { client } + before do + # fail on the first thing in begin block + allow_any_instance_of(Chef::RunLock).to receive(:save_pid).and_raise(e) + end + + it "should run exception handlers on early fail" do + expect(subject).to receive(:run_failed) + exception = nil + begin + subject.run + rescue e => ex + exception = ex + end + expect(exception).to be_instance_of(e) + end + end end |