drapergem/draper — pull request #440 by haines (2013-01-25 22:18:13+00:00)
Title: Improve Devise integration

I was hoping it might be as easy as providing a `@controller` and `@request` and letting Devise's own TestHelpers do all the heavy lifting, but unfortunately that makes it difficult to use a mock user because it has to respond to `serialize_into_session`. Stubbing `current_user` is therefore the better approach.

In order to make `sign_in` mocking-framework independent, I'm just defining the `current_user` as a method on the singleton class of the controller. I think this is legit because the controller is torn down at the end of each decorator test anyway. I also added an equivalent `sign_out` method.