diff options
author | Tim Smith <tsmith84@gmail.com> | 2020-01-29 15:12:00 -0800 |
---|---|---|
committer | Tim Smith <tsmith84@gmail.com> | 2020-01-29 15:12:00 -0800 |
commit | 909fcac15b3d42f251eaa0be80cb055e2ee95fef (patch) | |
tree | 062ab9c3fac7613fd7c5d373455544b2dd25ae30 | |
parent | a4ad6b43736221f2cbcf8a5b58285cc492446d16 (diff) | |
parent | c6e61abb9728e7834763f5c03bd436108278695a (diff) | |
download | ohai-909fcac15b3d42f251eaa0be80cb055e2ee95fef.tar.gz |
Merge branch 'salzig-fix/ensure_optional_plugins_to_be_symbols'
-rw-r--r-- | lib/ohai/config.rb | 2 | ||||
-rw-r--r-- | spec/unit/config_spec.rb | 7 |
2 files changed, 8 insertions, 1 deletions
diff --git a/lib/ohai/config.rb b/lib/ohai/config.rb index 66790d98..ea5eaff6 100644 --- a/lib/ohai/config.rb +++ b/lib/ohai/config.rb @@ -39,7 +39,7 @@ module Ohai # causes all optional plugins to be run. default :run_all_plugins, false # optional plugins are the set of plugins that are marked optional but you wish to run. - default :optional_plugins, [] + default(:optional_plugins, []).writes_value { |arr| arr.map(&:to_sym) } default :shellout_timeout, 30 end end diff --git a/spec/unit/config_spec.rb b/spec/unit/config_spec.rb index 61a59e5e..b78dc5c4 100644 --- a/spec/unit/config_spec.rb +++ b/spec/unit/config_spec.rb @@ -47,6 +47,13 @@ RSpec.describe Ohai::Config do .to raise_error(Ohai::Exceptions::PluginConfigError, /Expected Symbol/) end end + + describe "option :optional_plugins" do + it "Converts string values to symbols" do + described_class.ohai[:optional_plugins] = [ "Foo" ] + expect(described_class.ohai[:optional_plugins]).to eq([:Foo]) + end + end end describe "Ohai.config" do |