diff --git a/spec/type_aliases/httpstatus_spec.rb b/spec/type_aliases/httpstatus_spec.rb new file mode 100644 index 0000000..16721be --- /dev/null +++ b/spec/type_aliases/httpstatus_spec.rb @@ -0,0 +1,40 @@ +require 'spec_helper' + +if Puppet::Util::Package.versioncmp(Puppet.version, '4.5.0') >= 0 + describe 'Stdlib::HttpStatus' do + describe 'valid HTTP Status' do + [ + 200, + 302, + 404, + 418, + 503, + ].each do |value| + describe value.inspect do + it { is_expected.to allow_value(value) } + end + end + end + + describe 'invalid path handling' do + context 'garbage inputs' do + [ + nil, + [nil], + [nil, nil], + { 'foo' => 'bar' }, + {}, + '', + 'https', + '199', + 600, + 1_000, + ].each do |value| + describe value.inspect do + it { is_expected.not_to allow_value(value) } + end + end + end + end + end +end diff --git a/types/httpstatus.pp b/types/httpstatus.pp new file mode 100644 index 0000000..146587b --- /dev/null +++ b/types/httpstatus.pp @@ -0,0 +1 @@ +type Stdlib::HttpStatus = Integer[100, 599]