Sha256: 0eb08ab059174b5d8d74c930fe4f4908ee493b6437e0e801151a47720a69235f

Contents?: true

Size: 450 Bytes

Versions: 27

Compression:

Stored size: 450 Bytes

Contents

module SpecLoginHelper
  def sign_in(user)
    request.cookies[:remember_token] = user.remember_token
    self.current_user = user
  end

  def current_user
    @current_user ||= User.users.find_by_remember_token(request.cookies[:remember_token])
  end

  def current_user=(user)
    @current_user = user
  end

  def sign_in_user
    @user = create(:user)
    sign_in @user
  end
end

RSpec.configure do |config|
  config.include SpecLoginHelper
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
adeia-1.0.0 spec/support/spec_login_helper.rb
adeia-0.15.4 spec/support/spec_login_helper.rb
adeia-0.15.3 spec/support/spec_login_helper.rb
adeia-0.15.2 spec/support/spec_login_helper.rb
adeia-0.15.1 spec/support/spec_login_helper.rb
adeia-0.15.0 spec/support/spec_login_helper.rb
adeia-0.14.0 spec/support/spec_login_helper.rb
adeia-0.13.1 spec/support/spec_login_helper.rb
adeia-0.13.0 spec/support/spec_login_helper.rb
adeia-0.12.0 spec/support/spec_login_helper.rb
adeia-0.11.11 spec/support/spec_login_helper.rb
adeia-0.11.10 spec/support/spec_login_helper.rb
adeia-0.11.9 spec/support/spec_login_helper.rb
adeia-0.11.8 spec/support/spec_login_helper.rb
adeia-0.11.7 spec/support/spec_login_helper.rb
adeia-0.11.6 spec/support/spec_login_helper.rb
adeia-0.11.5 spec/support/spec_login_helper.rb
adeia-0.11.4 spec/support/spec_login_helper.rb
adeia-0.11.3 spec/support/spec_login_helper.rb
adeia-0.11.2 spec/support/spec_login_helper.rb