Uh oh!
There was an error while loading. Please reload this page.
Add support for non-default models - #57
Conversation
Default functionality has not changed, but the models that the helpers will use can be customized with beforeEach hooks. Default model names are also clarified by adding constant strings to the top of the helper file. - Update support for custom User model - Add support for custom AccessToken, Role, and RoleMapping model - Add check if models exist before referencing them - Use User.login instead of User.constructor.login - Add new and missing helper methods to helper test
ritch
commented
Jun 26, 2015
Could you post an example? I'm pretty sure we can land this. |
zero5100
commented
Jun 26, 2015
I just put these up by where I put the withApp call in my test files. They are all optional, and accept a string of the model name you want to use for each type. lt.beforeEach.withApp(app);lt.beforeEach.withUserModel("user");lt.beforeEach.withAccessTokenModel("accessToken");lt.beforeEach.withRoleModel("role");lt.beforeEach.withRoleMappingModel("roleMapping"); |
zero5100
commented
Jun 26, 2015
Please let me know when you are ready to merge this so I can fix the merge conflicts. |
beeman
commented
Aug 13, 2015
+1 |
STRML
commented
Sep 21, 2015
Could this please be merged? I'm seeing broken tests across the board mostly because of the |
There was a problem hiding this comment.
The User model name also needs to be dynamically resolved. So, test.user.id will not resolve. Something like below would work:
varuserModelName=test.userModel ? test.userModel : DEFAULT_USER_MODEL;RoleMapping.create({principalId: test[userModelName].id,principalType: RoleMapping.USER,roleId: result.id},..)There was a problem hiding this comment.
@zero5100 I would also suggest to add more tests to test the new and impacted existing methods.
Default functionality has not changed, but the models
that the helpers will use can be customized with beforeEach
hooks. Default model names are also clarified by adding
constant strings to the top of the helper file.