summaryrefslogtreecommitdiff
path: root/spec/unit/audit
diff options
context:
space:
mode:
authorClaire McQuin <claire@getchef.com>2015-05-19 17:11:10 -0700
committerBryan McLellan <btm@loftninjas.org>2015-05-27 14:16:29 -0400
commit166a6db885fe988c71c403c7f22c1d7b1189830a (patch)
treeafac877636e49f3f2dcc146de142d4724c48e646 /spec/unit/audit
parentdd89bd93841acf8aa64a9dc21f64e09d2fe7b762 (diff)
downloadchef-166a6db885fe988c71c403c7f22c1d7b1189830a.tar.gz
remove configuration option
Diffstat (limited to 'spec/unit/audit')
-rw-r--r--spec/unit/audit/audit_reporter_spec.rb50
1 files changed, 13 insertions, 37 deletions
diff --git a/spec/unit/audit/audit_reporter_spec.rb b/spec/unit/audit/audit_reporter_spec.rb
index 447fd5e357..f2d247644a 100644
--- a/spec/unit/audit/audit_reporter_spec.rb
+++ b/spec/unit/audit/audit_reporter_spec.rb
@@ -242,6 +242,10 @@ EOM
:message => "Audit phase failed with error message: derpderpderp",
:backtrace => ["/path/recipe.rb:57", "/path/library.rb:106"]) }
+ let(:run_error) { double("RunError", :class => "Chef::Exceptions::RunError",
+ :message => "This error shouldn't be reported.",
+ :backtrace => ["fix it", "fix it", "fix it"]) }
+
before do
allow(reporter).to receive(:auditing_enabled?).and_return(true)
allow(reporter).to receive(:run_status).and_return(run_status)
@@ -250,16 +254,11 @@ EOM
end
context "when no prior exception is stored" do
- it "reports the error" do
+ it "reports no error" do
expect(rest).to receive(:create_url)
expect(rest).to receive(:post)
- reporter.run_failed(audit_error)
- expect(run_data).to have_key(:error)
- expect(run_data[:error]).to eq <<-EOM.strip!
-Chef::Exceptions::AuditError: Audit phase failed with error message: derpderpderp
-/path/recipe.rb:57
-/path/library.rb:106
-EOM
+ reporter.run_failed(run_error)
+ expect(run_data).to_not have_key(:error)
end
end
@@ -268,39 +267,16 @@ EOM
reporter.instance_variable_set(:@exception, audit_error)
end
- context "when the error is the same as the prior exception" do
- it "reports one error" do
- expect(rest).to receive(:create_url)
- expect(rest).to receive(:post)
- reporter.run_failed(audit_error)
- expect(run_data).to have_key(:error)
- expect(run_data[:error]).to eq <<-EOM.strip!
-Chef::Exceptions::AuditError: Audit phase failed with error message: derpderpderp
-/path/recipe.rb:57
-/path/library.rb:106
-EOM
- end
- end
-
- context "when the error is not the same as the prior exception" do
- let(:converge_error) { double("ConvergeError", :class => "Chef::Exceptions::ConvergeError",
- :message => "Welp converge failed that's a bummer",
- :backtrace => ["/path/recipe.rb:14", "/path/library.rb:5"]) }
-
- it "reports both errors" do
- expect(rest).to receive(:create_url)
- expect(rest).to receive(:post)
- reporter.run_failed(converge_error)
- expect(run_data).to have_key(:error)
- expect(run_data[:error]).to eq <<-EOM.strip!
+ it "reports the prior error" do
+ expect(rest).to receive(:create_url)
+ expect(rest).to receive(:post)
+ reporter.run_failed(run_error)
+ expect(run_data).to have_key(:error)
+ expect(run_data[:error]).to eq <<-EOM.strip!
Chef::Exceptions::AuditError: Audit phase failed with error message: derpderpderp
/path/recipe.rb:57
/path/library.rb:106
-Chef::Exceptions::ConvergeError: Welp converge failed that's a bummer
-/path/recipe.rb:14
-/path/library.rb:5
EOM
- end
end
end
end