Sha256: 00bd4d52e9315e8d887ce6eea4814fabb2fe55bdb33a74ba517b90debb4c1b25

Contents?: true

Size: 589 Bytes

Versions: 4

Compression:

Stored size: 589 Bytes

Contents

# :nodoc: namespace
module Authpwn

# Included in test cases.
module TestExtensions
  # Sets the authenticated user in the test session.
  def set_session_current_user(user)
    request.session[:user_exuid] = user ? user.to_param : nil
  end
  
  # The authenticated user in the test session.
  def session_current_user
    return nil unless user_param = request.session[:user_exuid]
    User.find_by_param user_param
  end
end  # module Authpwn::TestExtensions

end  # namespace Authpwn


# :nodoc: extend Test::Unit
class ActionController::TestCase
  include Authpwn::TestExtensions
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
authpwn_rails-0.10.3 lib/authpwn_rails/test_extensions.rb
authpwn_rails-0.10.2 lib/authpwn_rails/test_extensions.rb
authpwn_rails-0.10.1 lib/authpwn_rails/test_extensions.rb
authpwn_rails-0.10.0 lib/authpwn_rails/test_extensions.rb