spec/lib/formats/json_spec.rb in hieracles-0.2.0 vs spec/lib/formats/json_spec.rb in hieracles-0.2.1

- old
+ new

@@ -11,26 +11,43 @@ { 'Node' => 'fqdn', 'Farm' => 'farm' } ) + allow(node).to receive(:notifications).and_return([]) } it { expect(json_format.info nil).to eq expected } end + describe ".facts" do + let(:expected) { '{"Node":"fqdn","Farm":"farm"}' } + before { + allow(node).to receive(:facts).and_return( + { + 'Node' => 'fqdn', + 'Farm' => 'farm' + } + ) + allow(node).to receive(:notifications).and_return([]) + } + it { expect(json_format.facts nil).to eq expected } + end + describe ".files" do - let(:expected) { '["path1","path2"]' } + let(:expected) { '{"files":["path1","path2"]}' } before { allow(node).to receive(:files).and_return(['path1', 'path2']) + allow(node).to receive(:notifications).and_return([]) } it { expect(json_format.files nil).to eq expected } end describe ".paths" do - let(:expected) { '["path1","path2"]' } + let(:expected) { '{"paths":["path1","path2"]}' } before { allow(node).to receive(:paths).and_return(['path1', 'path2']) + allow(node).to receive(:notifications).and_return([]) } it { expect(json_format.paths nil).to eq expected } end describe ".modules" do @@ -41,10 +58,11 @@ { 'module1' => "value", 'longmodule2' => "not found" } ) + allow(node).to receive(:notifications).and_return([]) } it { expect(json_format.modules nil).to eq expected } end describe ".params" do @@ -57,10 +75,11 @@ 'var' => 'value1' } } } ) + allow(node).to receive(:notifications).and_return([]) } it { expect(json_format.params nil).to eq expected } end describe ".allparams" do @@ -73,9 +92,10 @@ 'var' => 'value1' } } } ) + allow(node).to receive(:notifications).and_return([]) } it { expect(json_format.allparams nil).to eq expected } end end