The problem is that the session is lost as soon as the "visit" command is 
invoked.  How do I get the test to retain the session?

Also, that link you cited revolves around RSpec instead of Minitest.

Are there any good examples of someone who has successfully done what I'm 
trying to do?  I can't possibly be the first person to use Minitest for 
testing the visibility of a page for different types of users.

On Thursday, June 25, 2015 at 11:31:18 AM UTC-5, Ruby-Forum.com User wrote:
>
> 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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/ddf66cd1-2b16-4443-9c7c-a6c26986aba5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to