linnovate/mean — pull request #628 by markizs (2014-06-27 23:05:50+00:00)
Title: Article route tests & bugfix

I have added the Mocha route tests with Supertest, to unit test authorization for Article package, for people to use as an example. It took me a while to figure it out when I wanted to test routes in my project, as there were no examples included, so I figured that it would be good to share it.

Also included little helper, and put it under User test directory, as it is not related directly to Article package.

Besides that, during tests, I discovered the bug (tests!) and fixed it. Turns out that !req.user.isAdmin will always be negative, while !req.user.isAdmin() will use actual value that function returns and then will negate it.