I'm in the process of updating my integration tests to use the login_as function of the Devise gem INSTEAD of logging in the long way (with full authentication) in order to save time on tests. (I have an integration test that tests the login process. Since the full login process takes longer than login_as, there's no point repeating it in other tests.)
The code is in the login_as branch of my project at https://github.com/jhsu802701/generic_app_template_rails5/tree/login_as
. The test is at test/integration/admins_index_test.rb.
The admin index page should be visible to admins but not to users or non-logged-in visitors. I'm able to use login_as to log in as a user, but login_as doesn't work for logging in as an admin. The "puts page.body" shows that the test perceives an unregistered visitor instead of an admin.
What exactly am I overlooking?