Created
January 25, 2012 01:33
-
-
Save tansengming/1674026 to your computer and use it in GitHub Desktop.
Put this file into the spec/support dir and then include it into any controller spec that requires support for Devise
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module SecureEndpointHelper | |
| extend ActiveSupport::Concern | |
| included do | |
| include Devise::TestHelpers | |
| before do | |
| request.env["devise.mapping"] = Devise.mappings[:user] | |
| setup_controller_for_warden | |
| end | |
| end | |
| end | |
| # in controller spec | |
| # describe UsersController do | |
| # include SecureEndpointHelper | |
| # let(:user) { create(:user) } | |
| # before { sign_in(:user, user) } | |
| # end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment