Fixed a bug in checking supports (strings vs symbols)

Signed-off-by: Ryan Davis <zenspider@chef.io>
This commit is contained in:
Ryan Davis 2019-08-20 15:47:52 -07:00
parent 3f0f675364
commit 3b69967cc8
2 changed files with 6 additions and 4 deletions

View file

@ -31,8 +31,10 @@ module Inspec
def supports(criteria = nil)
return if criteria.nil?
Inspec::Resource.supports[@name] ||= []
Inspec::Resource.supports[@name].push(criteria)
key = @name.to_sym
Inspec::Resource.supports[key] ||= []
Inspec::Resource.supports[key].push(criteria)
end
def example(example = nil)
@ -80,7 +82,7 @@ module Inspec
def initialize(backend, name, *args)
@resource_skipped = false
@resource_failed = false
@supports = Inspec::Resource.supports[name]
@supports = Inspec::Resource.supports[name.to_sym]
@resource_exception_message = nil
# attach the backend to this instance

View file

@ -57,7 +57,7 @@ describe Inspec::Plugins::Resource do
describe "supported platform" do
def supports_meta(supports)
Inspec::Resource.supports["os"] = supports
Inspec::Resource.supports[:os] = supports
load_resource("os")
end