Skip to content

Commit 3556851

Browse files
committed
Add glue unit test for to_hiera_hash
1 parent 3b98192 commit 3556851

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

spec/puppet/resource_api/glue_spec.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,16 @@
7474
end
7575
end
7676

77+
describe '.to_hiera_hash' do
78+
it { expect(instance.to_hiera_hash).to eq " title:\n attr: value\n attr_ro: fixed\n" }
79+
80+
context 'when the title contains YAML special characters' do
81+
let(:title) { "foo:\nbar" }
82+
83+
it { expect(instance.to_hiera_hash).to eq " ? |-\n foo:\n bar\n : attr: value\n attr_ro: fixed\n" }
84+
end
85+
end
86+
7787
describe '.to_hash' do
7888
it { expect(instance.to_hash).to eq(namevarname: 'title', attr: 'value', attr_ro: 'fixed') }
7989
end

0 commit comments

Comments
 (0)