ankane/pretender

current_user must be defined before the impersonates method when using the Clearance gem

conwayanderson opened this issue · 3 comments

I'm getting the error current_user must be defined before the impersonates method when trying to implement this in an app that uses the Clearance user auth gem, which does have a current_user method. I'm not sure how to adjust the implementation to work, though.

screenshot 2017-06-06 19 18 57

Hey @conwayanderson, thanks for reporting 👍 This is fixed on master.

@ankane I'm getting this error in and RSpec test. Any suggestions on what's needed to test my controller methods that use Pretender?

It would be great to see some examples or guidance on testing impersonation in my controller.

I have same problem. To fix it I added devise_for :users, only: [] in config/routes.rb
But then tests fail.