X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=3rdparty%2Fmodules%2Fstdlib%2Fspec%2Faliases%2Fhttpsurl_spec.rb;fp=3rdparty%2Fmodules%2Fstdlib%2Fspec%2Faliases%2Fhttpsurl_spec.rb;h=3e51118ca67326405b87d4400dba00a9f789a889;hb=6963202b4b62c2816655ac9532521b018fdf83bd;hp=0000000000000000000000000000000000000000;hpb=a69999e580f8b3abd12446c2d6ad59e517651813;p=mirror%2Fdsa-puppet.git diff --git a/3rdparty/modules/stdlib/spec/aliases/httpsurl_spec.rb b/3rdparty/modules/stdlib/spec/aliases/httpsurl_spec.rb new file mode 100644 index 000000000..3e51118ca --- /dev/null +++ b/3rdparty/modules/stdlib/spec/aliases/httpsurl_spec.rb @@ -0,0 +1,44 @@ +require 'spec_helper' + +if Puppet::Util::Package.versioncmp(Puppet.version, '4.5.0') >= 0 + describe 'test::httpsurl', type: :class do + describe 'valid handling' do + %w{ + https://hello.com + https://notcreative.org + https://notexciting.co.uk + https://graphemica.com/❤ + https://graphemica.com/緩 + }.each do |value| + describe value.inspect do + let(:params) {{ value: value }} + it { is_expected.to compile } + end + end + end + + describe 'invalid path handling' do + context 'garbage inputs' do + [ + nil, + [ nil ], + [ nil, nil ], + { 'foo' => 'bar' }, + { }, + '', + "httds://notquiteright.org", + "hptts:/nah", + "https;//notrightbutclose.org", + "http://graphemica.com/❤", + "http://graphemica.com/緩" + ].each do |value| + describe value.inspect do + let(:params) {{ value: value }} + it { is_expected.to compile.and_raise_error(/parameter 'value' expects a match for Stdlib::HTTPSUrl/) } + end + end + end + + end + end +end