Created
May 4, 2011 15:01
-
-
Save toamitkumar/955364 to your computer and use it in GitHub Desktop.
This file contains 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
# Checks whether it's a devise mapped resource or not. | |
def is_devise_resource? #:nodoc: | |
raise ActionController::UnknownAction unless devise_mapping | |
end | |
# And also | |
# Attempt to find the mapped route for devise based on request path | |
def devise_mapping | |
@devise_mapping ||= request.env["devise.mapping"] | |
end | |
# Unfortunately this does not get set in your specs :( | |
# So set the following in your before block of controller tests | |
request.env["devise.mapping"] = Devise.mappings[:user] | |
# note the resource for you might be different |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment