spec/lib/formats/yaml_spec.rb in hieracles-0.0.2 vs spec/lib/formats/yaml_spec.rb in hieracles-0.0.3
- old
+ new
@@ -12,52 +12,73 @@
'Node' => 'fqdn',
'Farm' => 'farm'
}
)
}
- it "outputs proper text" do
- expect(yaml_format.info nil).to eq expected
- end
+ it { expect(yaml_format.info nil).to eq expected }
end
describe ".files" do
let(:expected) { "---\n- path1\n- path2\n" }
before {
allow(node).to receive(:files).and_return(['path1', 'path2'])
}
- it "outputs proper text" do
- expect(yaml_format.files nil).to eq expected
- end
+ it { expect(yaml_format.files nil).to eq expected }
end
describe ".paths" do
let(:expected) { "---\n- path1\n- path2\n" }
before {
allow(node).to receive(:paths).and_return(['path1', 'path2'])
}
- it "outputs proper text" do
- expect(yaml_format.paths nil).to eq expected
- end
+ it { expect(yaml_format.paths nil).to eq expected }
end
describe ".modules" do
+ let(:expected) { "---\nmodule1: value\nlongmodule2: not found\n" }
before {
allow(node).to receive(:modules).and_return(
{
'module1' => "value",
'longmodule2' => "not found"
}
)
}
- let(:expected) { "---\nmodule1: value\nlongmodule2: not found\n" }
- it "outputs proper text" do
- expect(yaml_format.modules nil).to eq expected
- end
+ it { expect(yaml_format.modules nil).to eq expected }
end
describe ".params" do
let(:expected) {
+ "---\n" +
+ "params: \n" +
+ " this: \n" +
+ " var: value1 # some/file"
+ }
+ before {
+ allow(node).to receive(:params).and_return(
+ {
+ 'params.this.var' => [{
+ file: 'some/file',
+ value: 'value1'
+ }]
+ }
+ )
+ allow(node).to receive(:params_tree).and_return(
+ {
+ 'params' => {
+ 'this' => {
+ 'var' => 'value1'
+ }
+ }
+ }
+ )
+ }
+ it { expect(yaml_format.params nil).to eq expected }
+ end
+
+ describe ".allparams" do
+ let(:expected) {
"---\n"+
"params: \n" +
" this: \n" +
" var: value1 # some/file"
}
@@ -78,12 +99,10 @@
}
}
}
)
}
- it "outputs proper text" do
- expect(yaml_format.params nil).to eq expected
- end
+ it { expect(yaml_format.allparams nil).to eq expected }
end
describe '.mergetree' do
context "with a simple string key-value" do
let(:params) {