@@ -146,25 +146,25 @@ _beforeEach.givenUserWithRole = function (attrs, role, optionalHandler) {
146
146
}
147
147
_beforeEach . givenUser ( attrs , function ( done ) {
148
148
var test = this ;
149
- test . app . models . Role . findOrCreate ( { name : role } , function ( err , result ) {
149
+ test . app . models . Role . findOrCreate ( { name : role . name } , function ( err , result ) {
150
150
if ( err ) {
151
151
console . error ( err . message ) ;
152
152
if ( err . details ) console . error ( err . details ) ;
153
153
return done ( err ) ;
154
154
}
155
155
156
156
test . userRole = result ;
157
- test . app . models . roleMapping . create (
158
- { principalId : test . user . id ,
159
- principalType : test . app . models . roleMapping . USER ,
157
+ test . app . models . RoleMapping . create (
158
+ { principalId : test . __USERMODEL__ . id ,
159
+ principalType : test . app . models . RoleMapping . USER ,
160
160
roleId : result . id } ,
161
161
function ( err , result ) {
162
162
if ( err ) {
163
163
console . error ( err . message ) ;
164
164
if ( err . details ) console . error ( err . details ) ;
165
165
return done ( err ) ;
166
166
}
167
-
167
+
168
168
test . userRoleMapping = result ;
169
169
done ( ) ;
170
170
}
@@ -328,7 +328,7 @@ _describe.whenCalledByUserWithRole = function (credentials, role, verb, url, dat
328
328
describe ( 'when called by logged in user with role ' + role , function ( ) {
329
329
_beforeEach . givenLoggedInUserWithRole ( credentials , role ) ;
330
330
_describe . whenCalledRemotely ( verb , url , data , cb ) ;
331
- } ) ;
331
+ } ) ;
332
332
}
333
333
334
334
_describe . whenCalledAnonymously = function ( verb , url , data , cb ) {
0 commit comments