-
Notifications
You must be signed in to change notification settings - Fork 638
/
http_auth_test.rb
28 lines (25 loc) · 914 Bytes
/
http_auth_test.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
require File.dirname(__FILE__) + '/../test_helper.rb'
module SessionTest
class HttpAuthTest < ActiveSupport::TestCase
class ConfiTest < ActiveSupport::TestCase
def test_allow_http_basic_auth
UserSession.allow_http_basic_auth = false
assert_equal false, UserSession.allow_http_basic_auth
UserSession.allow_http_basic_auth true
assert_equal true, UserSession.allow_http_basic_auth
end
end
class InstanceMethodsTest < ActiveSupport::TestCase
def test_persist_persist_by_http_auth
ben = users(:ben)
http_basic_auth_for { assert !UserSession.find }
http_basic_auth_for(ben) do
assert session = UserSession.find
assert_equal ben, session.record
assert_equal ben.login, session.login
assert_equal "benrocks", session.send(:protected_password)
end
end
end
end
end