File tree Expand file tree Collapse file tree 4 files changed +125
-0
lines changed Expand file tree Collapse file tree 4 files changed +125
-0
lines changed Original file line number Diff line number Diff line change 1+ require 'spec_helper'
2+
3+ if Puppet ::Util ::Package . versioncmp ( Puppet . version , '4.5.0' ) >= 0
4+ describe 'Stdlib::Http::Method' do
5+ describe 'valid HTTP Methods' do
6+ [
7+ 'HEAD' ,
8+ 'GET' ,
9+ 'PUT' ,
10+ 'DELETE' ,
11+ 'TRACE' ,
12+ ] . each do |value |
13+ describe value . inspect do
14+ it { is_expected . to allow_value ( value ) }
15+ end
16+ end
17+ end
18+
19+ describe 'invalid path handling' do
20+ context 'garbage inputs' do
21+ [
22+ nil ,
23+ [ nil ] ,
24+ [ nil , nil ] ,
25+ { 'foo' => 'bar' } ,
26+ { } ,
27+ '' ,
28+ 'https' ,
29+ '199' ,
30+ 600 ,
31+ 1_000 ,
32+ 'Ok' ,
33+ 'get' ,
34+ ] . each do |value |
35+ describe value . inspect do
36+ it { is_expected . not_to allow_value ( value ) }
37+ end
38+ end
39+ end
40+ end
41+ end
42+ end
Original file line number Diff line number Diff line change 1+ require 'spec_helper'
2+
3+ if Puppet ::Util ::Package . versioncmp ( Puppet . version , '4.5.0' ) >= 0
4+ describe 'Stdlib::Http::Status' do
5+ describe 'valid HTTP Status' do
6+ [
7+ 200 ,
8+ 302 ,
9+ 404 ,
10+ 418 ,
11+ 503 ,
12+ ] . each do |value |
13+ describe value . inspect do
14+ it { is_expected . to allow_value ( value ) }
15+ end
16+ end
17+ end
18+
19+ describe 'invalid path handling' do
20+ context 'garbage inputs' do
21+ [
22+ nil ,
23+ [ nil ] ,
24+ [ nil , nil ] ,
25+ { 'foo' => 'bar' } ,
26+ { } ,
27+ '' ,
28+ 'https' ,
29+ '199' ,
30+ 600 ,
31+ 1_000 ,
32+ ] . each do |value |
33+ describe value . inspect do
34+ it { is_expected . not_to allow_value ( value ) }
35+ end
36+ end
37+ end
38+ end
39+ end
40+ end
Original file line number Diff line number Diff line change 1+ # https://www.iana.org/assignments/http-methods/http-methods.xhtml
2+ type Stdlib::Http::Method = Enum[
3+ ' ACL' ,
4+ ' BASELINE-CONTROL' ,
5+ ' BIND' ,
6+ ' CHECKIN' ,
7+ ' CHECKOUT' ,
8+ ' CONNECT' ,
9+ ' COPY' ,
10+ ' DELETE' ,
11+ ' GET' ,
12+ ' HEAD' ,
13+ ' LABEL' ,
14+ ' LINK' ,
15+ ' LOCK' ,
16+ ' MERGE' ,
17+ ' MKACTIVITY' ,
18+ ' MKCALENDAR' ,
19+ ' MKCOL' ,
20+ ' MKREDIRECTREF' ,
21+ ' MKWORKSPACE' ,
22+ ' MOVE' ,
23+ ' OPTIONS' ,
24+ ' ORDERPATCH' ,
25+ ' PATCH' ,
26+ ' POST' ,
27+ ' PRI' ,
28+ ' PROPFIND' ,
29+ ' PROPPATCH' ,
30+ ' PUT' ,
31+ ' REBIND' ,
32+ ' REPORT' ,
33+ ' SEARCH' ,
34+ ' TRACE' ,
35+ ' UNBIND' ,
36+ ' UNCHECKOUT' ,
37+ ' UNLINK' ,
38+ ' UNLOCK' ,
39+ ' UPDATE' ,
40+ ' UPDATEREDIRECTREF' ,
41+ ' VERSION-CONTROL' ,
42+ ]
Original file line number Diff line number Diff line change 1+ type Stdlib::Http::Status = Integer[100 , 599 ]
You can’t perform that action at this time.
0 commit comments