@@ -12,7 +12,14 @@ describe('helpers', function () {
12
12
13
13
describe ( 'helpers.it' , function ( ) {
14
14
[ 'shouldBeAllowed' ,
15
- 'shouldBeDenied' ]
15
+ 'shouldBeDenied' ,
16
+ 'shouldNotBeFound' ,
17
+ 'shouldBeAllowedWhenCalledAnonymously' ,
18
+ 'shouldBeDeniedWhenCalledAnonymously' ,
19
+ 'shouldBeAllowedWhenCalledUnauthenticated' ,
20
+ 'shouldBeDeniedWhenCalledUnauthenticated' ,
21
+ 'shouldBeAllowedWhenCalledByUser' ,
22
+ 'shouldBeDeniedWhenCalledByUser' ]
16
23
. forEach ( function ( func ) {
17
24
it ( 'should have a method named ' + func , function ( ) {
18
25
assert . equal ( typeof helpers . it [ func ] , 'function' ) ;
@@ -22,8 +29,11 @@ describe('helpers', function () {
22
29
23
30
describe ( 'helpers.describe' , function ( ) {
24
31
[ 'staticMethod' ,
32
+ 'instanceMethod' ,
25
33
'whenLoggedInAsUser' ,
26
- 'whenCalledAnonymously' ]
34
+ 'whenCalledByUser' ,
35
+ 'whenCalledAnonymously' ,
36
+ 'whenCalledUnauthenticated' ]
27
37
. forEach ( function ( func ) {
28
38
it ( 'should have a method named ' + func , function ( ) {
29
39
assert . equal ( typeof helpers . describe [ func ] , 'function' ) ;
@@ -34,7 +44,10 @@ describe('helpers', function () {
34
44
describe ( 'helpers.beforeEach' , function ( ) {
35
45
[ 'withArgs' ,
36
46
'givenModel' ,
37
- 'givenUser' ]
47
+ 'givenUser' ,
48
+ 'givenLoggedInUser' ,
49
+ 'givenAnUnauthenticatedToken' ,
50
+ 'givenAnAnonymousToken' ]
38
51
. forEach ( function ( func ) {
39
52
it ( 'should have a helper method named ' + func , function ( ) {
40
53
assert . equal ( typeof helpers . beforeEach [ func ] , 'function' ) ;
@@ -59,5 +72,18 @@ describe('helpers', function () {
59
72
} ) ;
60
73
} ) ;
61
74
} ) ;
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
+ } ) ;
62
88
} ) ;
63
89
} ) ;
0 commit comments