spec/nanoc/base/entities/configuration_spec.rb in nanoc-4.7.9 vs spec/nanoc/base/entities/configuration_spec.rb in nanoc-4.7.10

- old
+ new

@@ -1,5 +1,7 @@ +# frozen_string_literal: true + describe Nanoc::Int::Configuration do let(:hash) { { foo: 'bar' } } let(:config) { described_class.new(hash: hash) } describe '#key?' do @@ -79,9 +81,22 @@ end it 'contains all other output dirs' do expect(subject).to include('output_staging') expect(subject).to include('output_prod') + end + end + + describe '#merge' do + let(:hash1) { { foo: { bar: 'baz', baz: ['biz'] } } } + let(:hash2) { { foo: { bar: :boz, biz: 'buz' } } } + let(:config1) { described_class.new(hash: hash1) } + let(:config2) { described_class.new(hash: hash2) } + + subject { config1.merge(config2).to_h } + + it 'contains the recursive merge of both configurations' do + expect(subject).to include(foo: { bar: :boz, baz: ['biz'], biz: 'buz' }) end end context 'with environments defined' do let(:hash) { { foo: 'bar', environments: { test: { foo: 'test-bar' }, default: { foo: 'default-bar' } } } }