summaryrefslogtreecommitdiff
path: root/spec/unit/audit
diff options
context:
space:
mode:
Diffstat (limited to 'spec/unit/audit')
-rw-r--r--spec/unit/audit/audit_event_proxy_spec.rb6
-rw-r--r--spec/unit/audit/audit_reporter_spec.rb24
-rw-r--r--spec/unit/audit/control_group_data_spec.rb23
-rw-r--r--spec/unit/audit/runner_spec.rb5
4 files changed, 28 insertions, 30 deletions
diff --git a/spec/unit/audit/audit_event_proxy_spec.rb b/spec/unit/audit/audit_event_proxy_spec.rb
index 39fa057cba..2496aef3e7 100644
--- a/spec/unit/audit/audit_event_proxy_spec.rb
+++ b/spec/unit/audit/audit_event_proxy_spec.rb
@@ -35,7 +35,7 @@ describe Chef::Audit::AuditEventProxy do
let(:description) { "poots" }
let(:group) { double("ExampleGroup", :parent_groups => parents,
- :description => description) }
+ :description => description) }
let(:notification) { double("Notification", :group => group) }
context "when notified from a top-level example group" do
@@ -121,8 +121,8 @@ describe Chef::Audit::AuditEventProxy do
let(:examples) { [example] }
let(:example) { double("Example", :metadata => metadata,
- :description => example_description,
- :full_description => full_description, :exception => nil) }
+ :description => example_description,
+ :full_description => full_description, :exception => nil) }
let(:metadata) {
{
diff --git a/spec/unit/audit/audit_reporter_spec.rb b/spec/unit/audit/audit_reporter_spec.rb
index 28f2f2db45..ed0aa622cc 100644
--- a/spec/unit/audit/audit_reporter_spec.rb
+++ b/spec/unit/audit/audit_reporter_spec.rb
@@ -29,7 +29,7 @@ describe Chef::Audit::AuditReporter do
let(:start_time) { Time.new(2014, 12, 3, 9, 31, 05, "-08:00") }
let(:end_time) { Time.new(2014, 12, 3, 9, 36, 14, "-08:00") }
let(:run_status) { instance_double(Chef::RunStatus, :node => node, :run_id => run_id,
- :start_time => start_time, :end_time => end_time) }
+ :start_time => start_time, :end_time => end_time) }
describe "#audit_phase_start" do
@@ -86,12 +86,12 @@ describe Chef::Audit::AuditReporter do
context "when audit phase failed" do
let(:audit_error) { double("AuditError", :class => "Chef::Exceptions::AuditError",
- :message => "Audit phase failed with error message: derpderpderp",
- :backtrace => ["/path/recipe.rb:57", "/path/library.rb:106"]) }
+ :message => "Audit phase failed with error message: derpderpderp",
+ :backtrace => ["/path/recipe.rb:57", "/path/library.rb:106"]) }
- before do
- reporter.instance_variable_set(:@audit_phase_error, audit_error)
- end
+ before do
+ reporter.instance_variable_set(:@audit_phase_error, audit_error)
+ end
it "reports an error" do
reporter.run_completed(node)
@@ -191,7 +191,7 @@ EOM
expect(error).to receive(:respond_to?).with(:response).and_return(false)
allow(Chef::Log).to receive(:error).and_return(true)
expect(Chef::Log).to receive(:error).with(/Reporting fatals enabled. Aborting run./)
- expect{ reporter.run_completed(node) }.to raise_error(error)
+ expect { reporter.run_completed(node) }.to raise_error(error)
end
end
@@ -234,12 +234,12 @@ EOM
let(:run_data) { audit_data.to_hash }
let(:audit_error) { double("AuditError", :class => "Chef::Exceptions::AuditError",
- :message => "Audit phase failed with error message: derpderpderp",
- :backtrace => ["/path/recipe.rb:57", "/path/library.rb:106"]) }
+ :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"]) }
+ :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)
@@ -366,7 +366,7 @@ EOM
context "when a control group with the same name has been seen" do
it "raises an exception" do
expect(ordered_control_groups).to receive(:has_key?).with(name).and_return(true)
- expect{ reporter.control_group_started(name) }.to raise_error(Chef::Exceptions::AuditControlGroupDuplicate)
+ expect { reporter.control_group_started(name) }.to raise_error(Chef::Exceptions::AuditControlGroupDuplicate)
end
end
end
diff --git a/spec/unit/audit/control_group_data_spec.rb b/spec/unit/audit/control_group_data_spec.rb
index a18e33a40a..f6935a4c75 100644
--- a/spec/unit/audit/control_group_data_spec.rb
+++ b/spec/unit/audit/control_group_data_spec.rb
@@ -72,8 +72,8 @@ describe Chef::Audit::AuditData do
describe ":control_groups" do
- let(:control_hash_1) { {:name => "control group 1"} }
- let(:control_hash_2) { {:name => "control group 2"} }
+ let(:control_hash_1) { { :name => "control group 1" } }
+ let(:control_hash_2) { { :name => "control group 2" } }
let(:control_groups) { audit_data_hash[:control_groups] }
@@ -123,9 +123,8 @@ describe Chef::Audit::ControlData do
let(:line_number) { 27 }
let(:control_data) { described_class.new(name: name,
- resource_type: resource_type, resource_name: resource_name,
- context: context, line_number: line_number) }
-
+ resource_type: resource_type, resource_name: resource_name,
+ context: context, line_number: line_number) }
describe "#to_hash" do
@@ -188,14 +187,14 @@ describe Chef::Audit::ControlGroupData do
include_context "control data"
let(:control) { Chef::Audit::ControlData.new(name: name,
- resource_type: resource_type, resource_name: resource_name,
- context: context, line_number: line_number) }
+ resource_type: resource_type, resource_name: resource_name,
+ context: context, line_number: line_number) }
before do
allow(Chef::Audit::ControlData).to receive(:new).
with(name: name, resource_type: resource_type,
- resource_name: resource_name, context: context,
- line_number: line_number).
+ resource_name: resource_name, context: context,
+ line_number: line_number).
and_return(control)
end
end
@@ -433,9 +432,9 @@ describe Chef::Audit::ControlGroupData do
context "with multiple controls added" do
- let(:control_hash_1) { {:line_number => 27} }
- let(:control_hash_2) { {:line_number => 13} }
- let(:control_hash_3) { {:line_number => 35} }
+ let(:control_hash_1) { { :line_number => 27 } }
+ let(:control_hash_2) { { :line_number => 13 } }
+ let(:control_hash_3) { { :line_number => 35 } }
let(:control_1) { double("control 1",
:line_number => control_hash_1[:line_number],
diff --git a/spec/unit/audit/runner_spec.rb b/spec/unit/audit/runner_spec.rb
index 70fff6faf3..4c03cab1d3 100644
--- a/spec/unit/audit/runner_spec.rb
+++ b/spec/unit/audit/runner_spec.rb
@@ -24,7 +24,6 @@ require "chef/audit/rspec_formatter"
require "rspec/support/spec/in_sub_process"
require "rspec/support/spec/stderr_splitter"
-
describe Chef::Audit::Runner do
include RSpec::Support::InSubProcess
@@ -100,8 +99,8 @@ describe Chef::Audit::Runner do
end
context "audits exist" do
- let(:audits) { {"audit_name" => group} }
- let(:group) {Struct.new(:args, :block).new(["group_name"], nil)}
+ let(:audits) { { "audit_name" => group } }
+ let(:group) { Struct.new(:args, :block).new(["group_name"], nil) }
it "sends the audits to the world" do
runner.send(:register_control_groups)