Stubbing Devise in rSpec and Rails3

前端 未结 2 1703
闹比i
闹比i 2021-01-30 04:21

How would you stub Devise in Rails 3 with rSpec. I have a UsersController and a User model. Both of which are associated with Devise at the moment, I\'

2条回答
  •  臣服心动
    2021-01-30 04:56

    You can try mocking the underlying warden (https://github.com/wardencommunity/warden/wiki) object which devise relies upon, here is a link to some details on how you can accomplish this with RSpec: http://www.michaelharrison.ws/weblog/?p=349 (entry covers some other topics as well, the solution you want is towards the bottom of the page.)

提交回复
热议问题