@@ -57,6 +57,32 @@ describe('Methods', function () {
5757 } ) ;
5858 } ) ;
5959
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+
6086 describe ( '.method' , function ( ) {
6187 it ( 'sets method' , function ( ) {
6288 expect ( yea . method ( 'GET' ) . toObject ( ) . method ) . to . equal ( 'GET' ) ;
@@ -67,6 +93,12 @@ describe('Methods', function () {
6793 expect ( yea . method ( 'gEt' ) . toObject ( ) . method ) . to . equal ( 'GET' ) ;
6894 } ) ;
6995
96+ it ( 'throws on unrecognized method' , function ( ) {
97+ expect ( function ( ) {
98+ yea . method ( 'foobar' ) ;
99+ } ) . to . throw ( 'Invalid method: \'FOOBAR\'' ) ;
100+ } ) ;
101+
70102 it ( 'is immutable' , function ( ) {
71103 var req = yea . method ( 'get' ) ;
72104 expect ( req ) . to . not . equal ( yea ) ;
0 commit comments