File tree Expand file tree Collapse file tree 5 files changed +122
-1
lines changed Expand file tree Collapse file tree 5 files changed +122
-1
lines changed Original file line number Diff line number Diff line change 1+ require 'spec_helper'
2+
3+ describe 'Stdlib::Http::Method' do
4+ describe 'valid HTTP Methods' do
5+ [
6+ 'HEAD' ,
7+ 'GET' ,
8+ 'PUT' ,
9+ 'DELETE' ,
10+ 'TRACE' ,
11+ ] . each do |value |
12+ describe value . inspect do
13+ it { is_expected . to allow_value ( value ) }
14+ end
15+ end
16+ end
17+
18+ describe 'invalid path handling' do
19+ context 'garbage inputs' do
20+ [
21+ nil ,
22+ [ nil ] ,
23+ [ nil , nil ] ,
24+ { 'foo' => 'bar' } ,
25+ { } ,
26+ '' ,
27+ 'https' ,
28+ '199' ,
29+ 600 ,
30+ 1_000 ,
31+ 'Ok' ,
32+ 'get' ,
33+ ] . each do |value |
34+ describe value . inspect do
35+ it { is_expected . not_to allow_value ( value ) }
36+ end
37+ end
38+ end
39+ end
40+ end
Original file line number Diff line number Diff line change 1+ require 'spec_helper'
2+
3+ describe 'Stdlib::Http::Status' do
4+ describe 'valid HTTP Status' do
5+ [
6+ 200 ,
7+ 302 ,
8+ 404 ,
9+ 418 ,
10+ 503 ,
11+ ] . each do |value |
12+ describe value . inspect do
13+ it { is_expected . to allow_value ( value ) }
14+ end
15+ end
16+ end
17+
18+ describe 'invalid path handling' do
19+ context 'garbage inputs' do
20+ [
21+ nil ,
22+ [ nil ] ,
23+ [ nil , nil ] ,
24+ { 'foo' => 'bar' } ,
25+ { } ,
26+ '' ,
27+ 'https' ,
28+ '199' ,
29+ 600 ,
30+ 1_000 ,
31+ ] . each do |value |
32+ describe value . inspect do
33+ it { is_expected . not_to allow_value ( value ) }
34+ end
35+ end
36+ end
37+ end
38+ 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 ]
Original file line number Diff line number Diff line change 1- type Stdlib::HttpStatus = Integer[ 100 , 599 ]
1+ type Stdlib::HttpStatus = Stdlib::Http::Status
You can’t perform that action at this time.
0 commit comments