Ruby on Rails Thursday, June 25, 2015

The code in question is at https://github.com/jhsu802701/generic_app_template/blob/master/test/integration/admins_view_test.rb .

I've used the Devise gem to create users and admins.  I've successfully made the admin index page visible ONLY to admins, but it's failing the tests (Capybara and minitest).  For some reason, executing the "visit" command kills the session.  WHY?  What should I be doing about this?

The source code is:

login_admin('elle_woods@example.com', 'Harvard Law', false)
# View admin index
admin_path = root_path + '/admins'
click_on 'Profile'

visit admin_path # NOTE: using the 'visit' command loses the session

@a1.reload
#assert_equal current_path, '/admins'
assert_text 'Vivian'
assert_text 'Kensington'
assert_text 'Elle'
assert_text 'Woods'



--
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/0eb82e88-304d-4858-a1cf-07c52e2c227d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment