Skip to content

Instantly share code, notes, and snippets.

@ryanoboril
Created July 12, 2014 01:32
Show Gist options
  • Save ryanoboril/6372e1eb7f8e66d53038 to your computer and use it in GitHub Desktop.
Save ryanoboril/6372e1eb7f8e66d53038 to your computer and use it in GitHub Desktop.
Sign in helper for a Devise project's rspec tests
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