Ruby on Rails Thursday, June 25, 2015

Hello Jason,

I think need to change some code. You need to test sections of your app
independently, so if you want to check if the view is only available for
Admins, you can login it with test methods provided by Devise and
later, visit the admins_path.

Instead of call login_admin, you can use:
login_as(user, :scope => :user)
visit admin_path

# asserts...

In another test, check if an admin can login with the form (like
login_admin). You need to set Warden to test mode including this line at
top of your integration tests:

include Warden::Test::Helpers
Warden.test_mode!

More info at:
https://github.com/plataformatec/devise/wiki/How-To:-Test-with-Capybara

Regards!

--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/cd0c9d98d74bcbd35f1164f64a908299%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment