Skip to content

Commit b5ad38b

Browse files
committed
Regression test for conditions with regex chars
1 parent bd5ad45 commit b5ad38b

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

spec/unit/puppet/provider/sshd_config_match/augeas_spec.rb

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,38 @@
4242
end
4343
end
4444

45+
context 'with condition containing regex chars' do
46+
let(:tmptarget) { aug_fixture('empty') }
47+
let(:target) { tmptarget.path }
48+
49+
it 'creates simple new entry' do
50+
apply!(Puppet::Type.type(:sshd_config_match).new(
51+
name: 'Host *',
52+
target: target,
53+
ensure: :present,
54+
provider: 'augeas'
55+
))
56+
57+
aug_open(target, 'Sshd.lns') do |aug|
58+
expect(aug.get('Match/Condition/Host')).to eq('*')
59+
end
60+
end
61+
62+
it 'creates new comment before entry' do
63+
apply!(Puppet::Type.type(:sshd_config_match).new(
64+
name: 'Host *',
65+
target: target,
66+
ensure: :present,
67+
comment: 'manage host *',
68+
provider: 'augeas'
69+
))
70+
71+
aug_open(target, 'Sshd.lns') do |aug|
72+
expect(aug.get('Match[Condition/Host]/Settings/#comment')).to eq('Host *: manage host *')
73+
end
74+
end
75+
end
76+
4577
context 'with full file' do
4678
let(:tmptarget) { aug_fixture('full') }
4779
let(:target) { tmptarget.path }

0 commit comments

Comments
 (0)