Sha256: 7af835a8a7289c9e95c2e8336dc80dfc668c4a8a682019af28aa68ae854165af
Contents?: true
Size: 1.07 KB
Versions: 2
Compression:
Stored size: 1.07 KB
Contents
require_relative 'test_helper' class TestExtensionsTest < ActionController::TestCase def setup @user = users(:john) @token = credentials(:john_session_token) end test 'session_current_user for no user' do assert_nil session_current_user end test 'session_current_user with valid suid' do request.session[:authpwn_suid] = @token.suid assert_equal @user, session_current_user end test 'set_session_current_user reuses existing token' do assert_no_difference 'Credential.count' do set_session_current_user @user end assert_equal @token.suid, request.session[:authpwn_suid] end test 'set_session_current_user creates token if necessary' do @token.destroy assert_difference 'Credential.count', 1 do set_session_current_user @user end assert_equal @user, session_current_user end test 'set_session_current_user to nil' do request.session[:authpwn_suid] = @token.suid assert_no_difference 'Credential.count' do set_session_current_user nil end assert_nil request.session[:authpwn_suid] end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
authpwn_rails-0.21.1 | test/test_extensions_test.rb |
authpwn_rails-0.21.0 | test/test_extensions_test.rb |