spec/lib/formats/yaml_spec.rb in hieracles-0.1.5 vs spec/lib/formats/yaml_spec.rb in hieracles-0.1.6

- old
+ new

@@ -125,11 +125,11 @@ context "with various boolean type of key-values (true)" do let(:params) { { 'key' => [{ file: 'what/file', - value: 'value' + value: 'true' }] } } let(:input) { { 'key' => true } @@ -142,11 +142,11 @@ context "with various boolean type of key-values (false)" do let(:params) { { 'key' => [{ file: 'what/file', - value: 'value' + value: 'false' }] } } let(:input) { { 'key' => false } @@ -159,11 +159,11 @@ context "with various fixnum type of key-values" do let(:params) { { 'key' => [{ file: 'what/file', - value: 'value' + value: '3' }] } } let(:input) { { 'key' => 3 } @@ -176,11 +176,11 @@ context "with various float type of key-values" do let(:params) { { 'key' => [{ file: 'what/file', - value: 'value' + value: '0.3' }] } } let(:input) { { 'key' => 0.3 } @@ -303,9 +303,46 @@ } } let(:expected) { "\nkey: \n sublevel: \n subsublevel: value # what/file" + "\nkey2: \n sublevel: value # what/file2" + } + it { expect(yaml_format.mergetree('', [], input, params)).to eq expected } + end + context "with a 3-levels double string key-value and override" do + let(:params) { + { + 'key.sublevel.subsublevel' => [{ + file: 'what/file', + value: 'value' + }], + 'key2.sublevel' => [ + { + file: 'what/file2', + value: 'value' + }, + { + file: 'what/file1', + value: 'value2' + } + ] + } + } + let(:input) { + { + 'key' => { + 'sublevel' => { + 'subsublevel' => 'value' + } + }, + 'key2' => { + 'sublevel' => 'value2' + } + } + } + let(:expected) { + "\nkey: \n sublevel: \n subsublevel: value # what/file" + + "\nkey2: \n sublevel: value2 # what/file1" } it { expect(yaml_format.mergetree('', [], input, params)).to eq expected } end end