jeudi 8 juin 2017

rails unit testing - bypass or authorize user

I have implemented pundit in rails and it is working fine. I have decorated each controllers with 'authorize'. Now I wanted to test the controller actions but all the tests fail as it keeps redirecting to the root path (www.example.com).

I have a user fixture with all the information needed to be authenticated but still the tests are redirected to the root path.

If I remove the authorize key word in the controller, the tests pass.

How to I fake pundit in unit testing (not Rspec) or bypass it?

Thanks

Aucun commentaire:

Enregistrer un commentaire