Skip to content

Commit 00e4012

Browse files
NatsukeLoicMahieu
authored andcommitted
Fix: wrong var names for givenUser
1 parent 284fb18 commit 00e4012

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

lib/helpers.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -146,25 +146,25 @@ _beforeEach.givenUserWithRole = function (attrs, role, optionalHandler) {
146146
}
147147
_beforeEach.givenUser(attrs, function (done) {
148148
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) {
150150
if(err) {
151151
console.error(err.message);
152152
if(err.details) console.error(err.details);
153153
return done(err);
154154
}
155155

156156
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,
160160
roleId: result.id},
161161
function (err, result) {
162162
if(err) {
163163
console.error(err.message);
164164
if(err.details) console.error(err.details);
165165
return done(err);
166166
}
167-
167+
168168
test.userRoleMapping = result;
169169
done();
170170
}
@@ -328,7 +328,7 @@ _describe.whenCalledByUserWithRole = function (credentials, role, verb, url, dat
328328
describe('when called by logged in user with role ' + role, function () {
329329
_beforeEach.givenLoggedInUserWithRole(credentials, role);
330330
_describe.whenCalledRemotely(verb, url, data, cb);
331-
});
331+
});
332332
}
333333

334334
_describe.whenCalledAnonymously = function(verb, url, data, cb) {

0 commit comments

Comments
 (0)