diff options
-rw-r--r-- | chef.gemspec | 4 | ||||
-rw-r--r-- | lib/chef/audit/audit_event_proxy.rb | 3 | ||||
-rw-r--r-- | spec/unit/audit/audit_event_proxy_spec.rb | 4 | ||||
-rw-r--r-- | spec/unit/exceptions_spec.rb | 2 | ||||
-rw-r--r-- | spec/unit/recipe_spec.rb | 7 |
5 files changed, 13 insertions, 7 deletions
diff --git a/chef.gemspec b/chef.gemspec index eb7528e630..43fb3d16fe 100644 --- a/chef.gemspec +++ b/chef.gemspec @@ -37,8 +37,8 @@ Gem::Specification.new do |s| %w(rspec-core rspec-expectations rspec-mocks).each { |gem| s.add_dependency gem, "~> 3.1" } s.add_dependency "rspec_junit_formatter", "~> 0.2.0" - s.add_dependency "serverspec", "~> 2.3" - s.add_dependency "specinfra", "~> 2.4" + s.add_dependency "serverspec", "~> 2.7" + s.add_dependency "specinfra", "~> 2.10" s.add_development_dependency "rack" diff --git a/lib/chef/audit/audit_event_proxy.rb b/lib/chef/audit/audit_event_proxy.rb index 36160db9bb..1e40258113 100644 --- a/lib/chef/audit/audit_event_proxy.rb +++ b/lib/chef/audit/audit_event_proxy.rb @@ -43,8 +43,7 @@ class Chef described_class = example.metadata[:described_class] if described_class resource_type = described_class.class.name.split(':')[-1] - # TODO https://github.com/serverspec/serverspec/pull/493 - resource_name = described_class.instance_variable_get(:@name) + resource_name = described_class.name end # The following code builds up the context - the list of wrapping `describe` or `control` blocks diff --git a/spec/unit/audit/audit_event_proxy_spec.rb b/spec/unit/audit/audit_event_proxy_spec.rb index 1fddde43f1..2c4a0a1b9a 100644 --- a/spec/unit/audit/audit_event_proxy_spec.rb +++ b/spec/unit/audit/audit_event_proxy_spec.rb @@ -204,7 +204,7 @@ describe Chef::Audit::AuditEventProxy do # Metadata fields let(:described_class) { double("Serverspec::Type::Port", - :class => "Serverspec::Type::Port") } + :class => "Serverspec::Type::Port", :name => resource_name) } # Control data fields let(:resource_type) { "Port" } @@ -262,7 +262,7 @@ describe Chef::Audit::AuditEventProxy do # Metadata parts let(:described_class) { double("Serverspec::Type::File", - :class => "Serverspec::Type::File") } + :class => "Serverspec::Type::File", :name => resource_name) } # Example group parts let(:parent_group) { diff --git a/spec/unit/exceptions_spec.rb b/spec/unit/exceptions_spec.rb index 165c11446b..d35ecc8ec8 100644 --- a/spec/unit/exceptions_spec.rb +++ b/spec/unit/exceptions_spec.rb @@ -85,7 +85,7 @@ describe Chef::Exceptions do describe Chef::Exceptions::RunFailedWrappingError do shared_examples "RunFailedWrappingError expectations" do it "should initialize with a default message" do - expect(e.message).to eq("Found #{num_errors} errors, they are stored in the backtrace\n") + expect(e.message).to eq("Found #{num_errors} errors, they are stored in the backtrace") end it "should provide a modified backtrace when requested" do diff --git a/spec/unit/recipe_spec.rb b/spec/unit/recipe_spec.rb index e1a42362ef..e8c1358ba2 100644 --- a/spec/unit/recipe_spec.rb +++ b/spec/unit/recipe_spec.rb @@ -484,4 +484,11 @@ describe Chef::Recipe do expect(node[:tags]).to eql([]) end end + + describe "included DSL" do + it "should include features from Chef::DSL::Audit" do + expect(recipe.singleton_class.included_modules).to include(Chef::DSL::Audit) + expect(recipe.respond_to?(:controls)).to be true + end + end end |