You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First of all im not sure is the error is with Roles or the jasmine for meteor package. But my best guess is that it's here.
Im trying to write some test, where I would validate the output from a template based on the roles i've setup.
In /test/jasmine I have a function in one of my specs that creates a user and adds a role to this user.
function createUser(user) {
Accounts.createUser({
email: user.email,
password: user.password,
profile: { name: user.name }
}, function (error) {
if (error != null) {
// Need _id of existing user record so this call must come
// after `Accounts.createUser` or `Accounts.onCreate`
//Meteor.users.update({_id: Meteor.userId()}, {$set: {'emails.0.verified': true}});
Roles.addUsersToRoles( Meteor.userId(), user.roles);
}
});
};
The idea is that everytime i need a user i create a user and attach the roles needed. This seems to work. But I am getting this error / warning in the console.
insert failed: MongoError: E11000 duplicate key error index: mocha-web.roles.$name_1 dup key: { : "athlete" }
This error is not showing up when I run the same 'code' in my /client og /server directories.
Furthermore i have for the purpose of test inserted this in my /server
Meteor.users.allow({
update: function (userId, user) {
return true;
}
});
Because otherwise i'm getting a Access denied from roles.js when updating the user. And I can't seem figure out why, since the Meteor documentation states that when creating a user with Accounts.createUser the users is also logged in. Any idea why i can't update the user object without a general update-allow for the Meteor.users?
Thanks in advance
The text was updated successfully, but these errors were encountered:
Hi Henrik, this should probably be posted to one of the velocity test framework repo's since it only happens when testing. But we can try to debug it here for now.
This error, insert failed: MongoError: E11000 duplicate key error index: mocha-web.roles.$name_1 dup key: { : "athlete" } has 'mocha-web' as the database. Is that expected? If not then I'd guess its some kind of a problem with the mirroring that velocity is doing.
For the second issue, if you put together a public reproduction up on github I'll help debug.
First of all im not sure is the error is with Roles or the jasmine for meteor package. But my best guess is that it's here.
Im trying to write some test, where I would validate the output from a template based on the roles i've setup.
In /test/jasmine I have a function in one of my specs that creates a user and adds a role to this user.
The idea is that everytime i need a user i create a user and attach the roles needed. This seems to work. But I am getting this error / warning in the console.
insert failed: MongoError: E11000 duplicate key error index: mocha-web.roles.$name_1 dup key: { : "athlete" }
This error is not showing up when I run the same 'code' in my /client og /server directories.
Furthermore i have for the purpose of test inserted this in my /server
Meteor.users.allow({
update: function (userId, user) {
return true;
}
});
Because otherwise i'm getting a Access denied from roles.js when updating the user. And I can't seem figure out why, since the Meteor documentation states that when creating a user with Accounts.createUser the users is also logged in. Any idea why i can't update the user object without a general update-allow for the Meteor.users?
Thanks in advance
The text was updated successfully, but these errors were encountered: