Skip to content

Add Stdlib::Ensure::Package type #1281

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

Merged
merged 1 commit into from
Mar 9, 2023
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions spec/type_aliases/ensure_package_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# frozen_string_literal: true

require 'spec_helper'

describe 'Stdlib::Ensure::Package' do
describe 'valid handling' do
[
'present',
'absent',
'purged',
'disabled',
'installed',
'latest',
'1',
'1.1',
'>=6.0',
].each do |value|
describe value.inspect do
it { is_expected.to allow_value(value) }
end
end
end
describe 'No complex types can match' do
context 'Garbage inputs, no complex or non string types can match' do
[
1,
1.1,
[1.1],
'',
{ 'foo' => 'bar' },
{},
].each do |value|
describe value.inspect do
it { is_expected.not_to allow_value(value) }
end
end
end
end
end
2 changes: 2 additions & 0 deletions types/ensure/package.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# @summary Validate the value of the ensure parameter for a package
type Stdlib::Ensure::Package = Variant[Enum['present', 'absent', 'purged', 'disabled', 'installed', 'latest'], String[1]]