@@ -57,6 +57,32 @@ describe('Methods', function () {
57
57
} ) ;
58
58
} ) ;
59
59
60
+ describe ( '.put' , function ( ) {
61
+ it ( 'sets method and URL' , function ( ) {
62
+ expect ( yea . put ( 'http://example.com/foo' ) . toObject ( ) . method ) . to . equal ( 'PUT' ) ;
63
+ expect ( yea . put ( 'http://example.com/foo' ) . toObject ( ) . url ) . to . equal ( 'http://example.com/foo' ) ;
64
+ } ) ;
65
+
66
+ it ( 'is immutable' , function ( ) {
67
+ var req = yea . put ( 'http://example.com/foo' ) ;
68
+ expect ( req ) . to . not . equal ( yea ) ;
69
+ expect ( req . constructor ) . to . equal ( yea . constructor ) ;
70
+ } ) ;
71
+ } ) ;
72
+
73
+ describe ( '.delete' , function ( ) {
74
+ it ( 'sets method and URL' , function ( ) {
75
+ expect ( yea . delete ( 'http://example.com/foo' ) . toObject ( ) . method ) . to . equal ( 'DELETE' ) ;
76
+ expect ( yea . delete ( 'http://example.com/foo' ) . toObject ( ) . url ) . to . equal ( 'http://example.com/foo' ) ;
77
+ } ) ;
78
+
79
+ it ( 'is immutable' , function ( ) {
80
+ var req = yea . delete ( 'http://example.com/foo' ) ;
81
+ expect ( req ) . to . not . equal ( yea ) ;
82
+ expect ( req . constructor ) . to . equal ( yea . constructor ) ;
83
+ } ) ;
84
+ } ) ;
85
+
60
86
describe ( '.method' , function ( ) {
61
87
it ( 'sets method' , function ( ) {
62
88
expect ( yea . method ( 'GET' ) . toObject ( ) . method ) . to . equal ( 'GET' ) ;
@@ -67,6 +93,12 @@ describe('Methods', function () {
67
93
expect ( yea . method ( 'gEt' ) . toObject ( ) . method ) . to . equal ( 'GET' ) ;
68
94
} ) ;
69
95
96
+ it ( 'throws on unrecognized method' , function ( ) {
97
+ expect ( function ( ) {
98
+ yea . method ( 'foobar' ) ;
99
+ } ) . to . throw ( 'Invalid method: \'FOOBAR\'' ) ;
100
+ } ) ;
101
+
70
102
it ( 'is immutable' , function ( ) {
71
103
var req = yea . method ( 'get' ) ;
72
104
expect ( req ) . to . not . equal ( yea ) ;
0 commit comments