Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Need to map route so devise works in functional tests #1895

Closed
pothibo opened this Issue Jun 7, 2012 · 3 comments

Comments

Projects
None yet
2 participants

pothibo commented Jun 7, 2012

I'm using ruby 1.9.3 and rails 3.2.3 and everytime I want to use devise, I need to add this to my setup method:

@request.env["devise.mapping"] = Devise.mappings[:user]

any reason why this is happening?

Owner

josevalim commented Jun 7, 2012

It is required so Devise knows which scope is accessing the app, since
functional tests skip the router. Please remember to use the mailing list
for questions.

Sent from my iPhone

@josevalim josevalim closed this Jun 7, 2012

pothibo commented Jun 7, 2012

Well this is mentionned nowhere in the documentation, I had to browse the web for 3 hours to finally figure out I had to do this.... The way it is explained in the doc mislead me to think that adding

class ActionController::TestCase
  include Devise::TestHelpers
end

Was the only needed step. This is why I opened this issue, since I believe it should be mentionned in the README

@josevalim josevalim reopened this Jun 7, 2012

@josevalim josevalim closed this in 985b646 Jun 7, 2012

pothibo commented Jun 7, 2012

Thank you !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment