Created
July 12, 2014 01:32
-
-
Save ryanoboril/6372e1eb7f8e66d53038 to your computer and use it in GitHub Desktop.
Sign in helper for a Devise project's rspec tests
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rails_helper' | |
include Warden::Test::Helpers | |
module SignInHelper | |
def sign_in_as_a_valid_user | |
Warden.test_mode! | |
user = FactoryGirl.create(:user) | |
login_as(user, :scope => :user) | |
end | |
def sign_out | |
Warden.test_reset! | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment