diff options
author | Nikita Mathur <nikita.mathur@chef.io> | 2022-06-07 14:34:50 +0530 |
---|---|---|
committer | Nikita Mathur <nikita.mathur@chef.io> | 2022-06-07 14:34:52 +0530 |
commit | 62585a2cfebada08c829234efe585874305c7372 (patch) | |
tree | 834c75aa03cfb1418419729e32407cba603c05fd /spec/mixlib/config_spec.rb | |
parent | fc32fe0b64b0338f7d7261ed3205f3142b9b8d20 (diff) | |
download | mixlib-config-nm/nested-hash-config.tar.gz |
Spec added for nested hash when configurables are presentnm/nested-hash-config
Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>
Diffstat (limited to 'spec/mixlib/config_spec.rb')
-rw-r--r-- | spec/mixlib/config_spec.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/spec/mixlib/config_spec.rb b/spec/mixlib/config_spec.rb index 1155e75..974111e 100644 --- a/spec/mixlib/config_spec.rb +++ b/spec/mixlib/config_spec.rb @@ -1298,6 +1298,27 @@ describe Mixlib::Config do expect(ConfigIt.windows_path).to eql('C:\Windows Has Awful\Paths') end end + context "when configurable and hash is defined" do + before :each do + @klass = Class.new + @klass.extend(::Mixlib::Config) + @klass.class_eval do + configurable(:environment) do |c| + c.defaults_to({}) + end + end + end + + let(:hash) do + { + environment: { "GEM_PATH" => "SOME_PATH" }, + } + end + it "configures the config object from a hash" do + hash_config = @klass.from_hash(hash) + expect(hash_config[:environment]).to eql({ "GEM_PATH" => "SOME_PATH" }) + end + end context "when contexts in the hash are undefined and strict disabled" do before do ConfigIt.strict_mode = true |