diff options
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 |