Login for feature test with warden test helpers
Warden provides a way to login as a user without having to go through the web interface that a user generally sees for sign in.
user = FactoryGirl.create(:user)
login_as user, scope: :user
In the config block for Rspec you would include this statement:
config.include Warden::Test::Helpers, type: :feature
If you have different models for different types of users in your system you
can sign in with different scopes. Lets say you have a student
user concept, you can sign in with:
student = FactoryGirl.create(:student)
login_as student, scope: :student
Tweet