File tree Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -380,6 +380,33 @@ _it.shouldNotBeFound = function() {
380
380
} ) ;
381
381
}
382
382
383
+ _it . shouldBeForbidden = function ( ) {
384
+ it ( 'should be forbidden' , function ( ) {
385
+ assert ( this . res ) ;
386
+ if ( this . res . statusCode !== 403 ) {
387
+ console . log ( this . res . body ) ;
388
+ }
389
+ assert . equal ( this . res . statusCode , 403 ) ;
390
+ } ) ;
391
+ }
392
+
393
+ _it . shouldBeRejected = function ( statusCode ) {
394
+ it ( 'should be rejected' + ( statusCode ? ' with status code ' + statusCode : '' ) , function ( ) {
395
+ assert ( this . res ) ;
396
+ if ( statusCode ) {
397
+ if ( this . res . statusCode !== statusCode ) {
398
+ console . log ( this . res . body ) ;
399
+ }
400
+ expect ( this . res . statusCode ) . to . equal ( statusCode ) ;
401
+ } else {
402
+ if ( this . res . statusCode < 400 || this . res . statusCode > 499 ) {
403
+ console . log ( this . res . body ) ;
404
+ }
405
+ expect ( this . res . statusCode ) . to . be . within ( 400 , 499 ) ;
406
+ }
407
+ } ) ;
408
+ }
409
+
383
410
_it . shouldBeAllowedWhenCalledAnonymously =
384
411
function ( verb , url , data ) {
385
412
_describe . whenCalledAnonymously ( verb , url , data , function ( ) {
Original file line number Diff line number Diff line change @@ -17,6 +17,8 @@ describe('helpers', function () {
17
17
[ 'shouldBeAllowed' ,
18
18
'shouldBeDenied' ,
19
19
'shouldNotBeFound' ,
20
+ 'shouldBeForbidden' ,
21
+ 'shouldBeRejected' ,
20
22
'shouldBeAllowedWhenCalledAnonymously' ,
21
23
'shouldBeDeniedWhenCalledAnonymously' ,
22
24
'shouldBeAllowedWhenCalledUnauthenticated' ,
You can’t perform that action at this time.
0 commit comments