@@ -12,7 +12,14 @@ describe('helpers', function () {
1212
1313 describe ( 'helpers.it' , function ( ) {
1414 [ 'shouldBeAllowed' ,
15- 'shouldBeDenied' ]
15+ 'shouldBeDenied' ,
16+ 'shouldNotBeFound' ,
17+ 'shouldBeAllowedWhenCalledAnonymously' ,
18+ 'shouldBeDeniedWhenCalledAnonymously' ,
19+ 'shouldBeAllowedWhenCalledUnauthenticated' ,
20+ 'shouldBeDeniedWhenCalledUnauthenticated' ,
21+ 'shouldBeAllowedWhenCalledByUser' ,
22+ 'shouldBeDeniedWhenCalledByUser' ]
1623 . forEach ( function ( func ) {
1724 it ( 'should have a method named ' + func , function ( ) {
1825 assert . equal ( typeof helpers . it [ func ] , 'function' ) ;
@@ -22,8 +29,11 @@ describe('helpers', function () {
2229
2330 describe ( 'helpers.describe' , function ( ) {
2431 [ 'staticMethod' ,
32+ 'instanceMethod' ,
2533 'whenLoggedInAsUser' ,
26- 'whenCalledAnonymously' ]
34+ 'whenCalledByUser' ,
35+ 'whenCalledAnonymously' ,
36+ 'whenCalledUnauthenticated' ]
2737 . forEach ( function ( func ) {
2838 it ( 'should have a method named ' + func , function ( ) {
2939 assert . equal ( typeof helpers . describe [ func ] , 'function' ) ;
@@ -34,7 +44,10 @@ describe('helpers', function () {
3444 describe ( 'helpers.beforeEach' , function ( ) {
3545 [ 'withArgs' ,
3646 'givenModel' ,
37- 'givenUser' ]
47+ 'givenUser' ,
48+ 'givenLoggedInUser' ,
49+ 'givenAnUnauthenticatedToken' ,
50+ 'givenAnAnonymousToken' ]
3851 . forEach ( function ( func ) {
3952 it ( 'should have a helper method named ' + func , function ( ) {
4053 assert . equal ( typeof helpers . beforeEach [ func ] , 'function' ) ;
@@ -59,5 +72,18 @@ describe('helpers', function () {
5972 } ) ;
6073 } ) ;
6174 } ) ;
75+ helpers . describe . staticMethod ( 'findById' , function ( ) {
76+ helpers . beforeEach . givenModel ( 'xxx-test-model' , { foo : 'bar' } ) ;
77+ helpers . describe . whenCalledRemotely ( 'GET' , function ( ) {
78+ return '/xxx-test-models/' + this [ 'xxx-test-model' ] . id ;
79+ } , function ( ) {
80+ it ( 'should retrieve the expected model in the first test' , function ( ) {
81+ assert . equal ( this . res . body . id , this [ 'xxx-test-model' ] . id ) ;
82+ } ) ;
83+ it ( 'should retrieve the expected model in subsequent tests' , function ( ) {
84+ assert . equal ( this . res . body . id , this [ 'xxx-test-model' ] . id ) ;
85+ } ) ;
86+ } ) ;
87+ } ) ;
6288 } ) ;
6389} ) ;
0 commit comments