spec/lib/formats/csv_spec.rb in hieracles-0.3.0 vs spec/lib/formats/csv_spec.rb in hieracles-0.3.1

- old
+ new

@@ -64,42 +64,26 @@ end end describe ".build_params_line" do context "with array values" do - context "when not merged" do - let(:expected) { - "0;1;params.this.var;[\"value1\"];0\n"+ - "1;0;params.this.var;[\"value1\"];1\n" - } - let(:params) { - [ - { file: 'path1', value: ['value1'], merged: ['value1'] }, - { file: 'path2', value: ['value1'], merged: ['value1'] }, - ] - } - before { - allow(node).to receive(:files).and_return(['path1', 'path2']) - } - it "outputs proper text" do - expect(csv_format.send :build_params_line, - "params.this.var", - params, - nil).to eq expected - end - end context "when merged" do let(:expected) { - "0;0;params.this.var;[\"value1\", \"value2\"];0\n"+ - "0;1;params.this.var;[\"value2\"];1\n"+ - "1;0;params.this.var;[\"value1\"];1\n" + "0;0;params.this.var;[\"value1\", \"value2\"];0\n" + + "1;0;params.this.var;[\"value1\"];1\n" + + "0;1;params.this.var;[\"value2\"];1\n" } let(:params) { - [ - { file: 'path1', value: ['value1'], merged: ['value1'] }, - { file: 'path2', value: ['value2'], merged: ['value1','value2'] }, - ] + { + file: '-', + value: ['value1','value2'], + overriden: true, + found_in: [ + { file: 'path1', value: ['value1'] }, + { file: 'path2', value: ['value2'] } + ] + } } before { allow(node).to receive(:files).and_return(['path1', 'path2']) } it "outputs proper text" do @@ -110,17 +94,23 @@ end end end context "with non-array values" do let(:expected) { - "0;1;params.this.var;value2;0\n"+ - "1;0;params.this.var;value1;1\n" + "0;0;params.this.var;value1;0\n" + + "1;0;params.this.var;value1;1\n" + + "0;1;params.this.var;value2;1\n" } let(:params) { - [ - { file: 'path1', value: 'value1', merged: 'value1' }, - { file: 'path2', value: 'value2', merged: 'value2' }, - ] + { + file: '-', + value: 'value1', + overriden: true, + found_in: [ + { file: 'path1', value: 'value1' }, + { file: 'path2', value: 'value2' } + ] + } } before { allow(node).to receive(:files).and_return(['path1', 'path2']) } it "outputs proper text" do