Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix regexp for $ensure params #609

Merged
merged 1 commit into from Jun 6, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion manifests/key.pp
Expand Up @@ -49,7 +49,7 @@
}

validate_re($_id, ['\A(0x)?[0-9a-fA-F]{8}\Z', '\A(0x)?[0-9a-fA-F]{16}\Z', '\A(0x)?[0-9a-fA-F]{40}\Z'])
validate_re($ensure, ['\Aabsent|present\Z',])
validate_re($ensure, ['\A(absent|present)\Z',])

if $_content {
validate_string($_content)
Expand Down
16 changes: 9 additions & 7 deletions spec/defines/key_spec.rb
Expand Up @@ -268,13 +268,15 @@
end

context 'invalid ensure' do
let :params do
{
:ensure => 'foo',
}
end
it 'fails' do
expect { subject.call }.to raise_error(/does not match/)
%w(foo aabsent absenta apresent presenta).each do |param|
let :params do
{
:ensure => param,
}
end
it 'fails' do
expect { subject.call }.to raise_error(/does not match/)
end
end
end

Expand Down