janus 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +65 -29
- data/lib/janus.rb +1 -13
- data/lib/janus/config.rb +9 -5
- data/lib/janus/controllers/confirmations_controller.rb +2 -0
- data/lib/janus/controllers/helpers.rb +17 -0
- data/lib/janus/controllers/internal_helpers.rb +12 -0
- data/lib/janus/controllers/passwords_controller.rb +3 -0
- data/lib/janus/controllers/sessions_controller.rb +58 -21
- data/lib/janus/manager.rb +7 -2
- data/lib/janus/models/database_authenticatable.rb +22 -6
- data/lib/janus/rails.rb +17 -0
- data/lib/janus/routes.rb +1 -2
- data/lib/janus/sinatra.rb +51 -0
- metadata +63 -169
- data/test/functional/home_controller_test.rb +0 -8
- data/test/functional/janus/mailer_test.rb +0 -14
- data/test/functional/janus/manager_test.rb +0 -94
- data/test/functional/users/confirmations_controller_test.rb +0 -59
- data/test/functional/users/passwords_controller_test.rb +0 -101
- data/test/functional/users/registrations_controller_test.rb +0 -112
- data/test/functional/users/sessions_controller_test.rb +0 -100
- data/test/functional/users_controller_test.rb +0 -22
- data/test/integration/users/rememberable_test.rb +0 -32
- data/test/integration/users/remote_test.rb +0 -72
- data/test/integration/users/sessions_test.rb +0 -18
- data/test/integration/users/trackable_test.rb +0 -22
- data/test/rails_app/app/controllers/application_controller.rb +0 -9
- data/test/rails_app/app/controllers/blogs_controller.rb +0 -6
- data/test/rails_app/app/controllers/home_controller.rb +0 -4
- data/test/rails_app/app/controllers/users/confirmations_controller.rb +0 -3
- data/test/rails_app/app/controllers/users/passwords_controller.rb +0 -3
- data/test/rails_app/app/controllers/users/registrations_controller.rb +0 -7
- data/test/rails_app/app/controllers/users/sessions_controller.rb +0 -11
- data/test/rails_app/app/controllers/users_controller.rb +0 -9
- data/test/rails_app/app/helpers/application_helper.rb +0 -2
- data/test/rails_app/app/mailers/janus_mailer.rb +0 -2
- data/test/rails_app/app/models/remote_token.rb +0 -6
- data/test/rails_app/app/models/user.rb +0 -8
- data/test/rails_app/config/application.rb +0 -42
- data/test/rails_app/config/boot.rb +0 -6
- data/test/rails_app/config/environment.rb +0 -5
- data/test/rails_app/config/environments/development.rb +0 -26
- data/test/rails_app/config/environments/production.rb +0 -49
- data/test/rails_app/config/environments/test.rb +0 -36
- data/test/rails_app/config/initializers/janus.rb +0 -11
- data/test/rails_app/config/initializers/secret_token.rb +0 -7
- data/test/rails_app/config/initializers/session_store.rb +0 -8
- data/test/rails_app/config/routes.rb +0 -12
- data/test/rails_app/db/migrate/20110323153820_create_users.rb +0 -34
- data/test/rails_app/db/migrate/20110331153546_create_remote_tokens.rb +0 -15
- data/test/rails_app/db/schema.rb +0 -45
- data/test/rails_app/db/seeds.rb +0 -7
- data/test/test_helper.rb +0 -103
- data/test/unit/confirmable_test.rb +0 -36
- data/test/unit/janus_test.rb +0 -27
- data/test/unit/rememberable_test.rb +0 -50
- data/test/unit/remote_authenticatable_test.rb +0 -37
- data/test/unit/remote_token_test.rb +0 -9
- data/test/unit/reset_password_test.rb +0 -45
- data/test/unit/trackable_test.rb +0 -21
- data/test/unit/user_test.rb +0 -60
@@ -1,59 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
class Users::ConfirmationsControllerTest < ActionController::TestCase
|
4
|
-
test "should get show with token" do
|
5
|
-
users(:julien).generate_confirmation_token
|
6
|
-
users(:julien).save!
|
7
|
-
|
8
|
-
assert_difference('User.count(:confirmed_at)') do
|
9
|
-
get :show, :confirm_token => users(:julien).confirmation_token
|
10
|
-
assert_redirected_to root_url
|
11
|
-
assert flash[:notice]
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
test "should not get show without token" do
|
16
|
-
assert_no_difference('User.count(:confirmed_at)') do
|
17
|
-
get :show
|
18
|
-
assert_response :ok
|
19
|
-
assert_template 'new'
|
20
|
-
assert_select '#error_explanation'
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
test "should not get show with bad token" do
|
25
|
-
users(:julien).generate_reset_password_token!
|
26
|
-
|
27
|
-
assert_no_difference('User.count(:confirmed_at)') do
|
28
|
-
get :show, :token => "aiorujfqptezjsmdguspfofkn"
|
29
|
-
assert_response :ok
|
30
|
-
assert_template 'new'
|
31
|
-
assert_select '#error_explanation'
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
test "should get new" do
|
36
|
-
get :new
|
37
|
-
assert_response :ok
|
38
|
-
assert_select '#user_email', 1
|
39
|
-
end
|
40
|
-
|
41
|
-
test "should create" do
|
42
|
-
assert_email do
|
43
|
-
post :create, :user => { :email => users(:julien).email }
|
44
|
-
end
|
45
|
-
|
46
|
-
assert_redirected_to root_url
|
47
|
-
assert flash[:notice]
|
48
|
-
end
|
49
|
-
|
50
|
-
test "should not create" do
|
51
|
-
assert_no_email do
|
52
|
-
post :create, :user => { :email => 'nobody@example.com' }
|
53
|
-
end
|
54
|
-
|
55
|
-
assert_response :ok
|
56
|
-
assert_template 'new'
|
57
|
-
assert_select '#error_explanation'
|
58
|
-
end
|
59
|
-
end
|
@@ -1,101 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
class Users::PasswordsControllerTest < ActionController::TestCase
|
4
|
-
setup do
|
5
|
-
@attributes = {
|
6
|
-
:password => "azerty",
|
7
|
-
:password_confirmation => "azerty"
|
8
|
-
}
|
9
|
-
end
|
10
|
-
|
11
|
-
test "should get new" do
|
12
|
-
get :new
|
13
|
-
assert_response :ok
|
14
|
-
assert_select '#user_email', 1
|
15
|
-
end
|
16
|
-
|
17
|
-
test "should get edit with token" do
|
18
|
-
users(:julien).generate_reset_password_token!
|
19
|
-
|
20
|
-
get :edit, :token => users(:julien).reset_password_token
|
21
|
-
assert_response :ok
|
22
|
-
assert_select '#user_reset_password_token', 1
|
23
|
-
assert_select '#user_password', 1
|
24
|
-
assert_select '#user_password_confirmation', 1
|
25
|
-
end
|
26
|
-
|
27
|
-
test "should not get edit without token" do
|
28
|
-
get :edit
|
29
|
-
assert_redirected_to root_url
|
30
|
-
assert flash[:alert]
|
31
|
-
end
|
32
|
-
|
33
|
-
test "should not get edit with bad token" do
|
34
|
-
users(:julien).generate_reset_password_token!
|
35
|
-
|
36
|
-
get :edit, :token => "aiorujfqptezjsmdguspfofkn"
|
37
|
-
assert_redirected_to root_url
|
38
|
-
assert flash[:alert]
|
39
|
-
end
|
40
|
-
|
41
|
-
test "should create" do
|
42
|
-
assert_email do
|
43
|
-
post :create, :user => { :email => users(:julien).email }
|
44
|
-
end
|
45
|
-
assert_redirected_to root_url
|
46
|
-
assert flash[:notice]
|
47
|
-
end
|
48
|
-
|
49
|
-
test "should not create" do
|
50
|
-
assert_no_email do
|
51
|
-
post :create, :user => { :email => 'nobody@example.com' }
|
52
|
-
end
|
53
|
-
assert_response :ok
|
54
|
-
assert_template 'new'
|
55
|
-
assert_select '#error_explanation'
|
56
|
-
end
|
57
|
-
|
58
|
-
test "should update" do
|
59
|
-
users(:julien).generate_reset_password_token!
|
60
|
-
|
61
|
-
put :update, :user => @attributes.merge(:reset_password_token => users(:julien).reset_password_token)
|
62
|
-
assert_redirected_to root_url
|
63
|
-
assert flash[:notice]
|
64
|
-
|
65
|
-
users(:julien).reload
|
66
|
-
|
67
|
-
assert_nil users(:julien).reset_password_token
|
68
|
-
assert_nil users(:julien).reset_password_sent_at
|
69
|
-
assert users(:julien).valid_password?(@attributes[:password])
|
70
|
-
end
|
71
|
-
|
72
|
-
test "should not update" do
|
73
|
-
users(:julien).generate_reset_password_token!
|
74
|
-
|
75
|
-
put :update, :user => @attributes.merge(
|
76
|
-
:reset_password_token => users(:julien).reset_password_token,
|
77
|
-
:password_confirmation => "qwerty"
|
78
|
-
)
|
79
|
-
assert_response :ok
|
80
|
-
assert_template 'users/passwords/edit'
|
81
|
-
assert_select '#error_explanation'
|
82
|
-
|
83
|
-
users(:julien).reload
|
84
|
-
|
85
|
-
assert_not_nil users(:julien).reset_password_token
|
86
|
-
assert_not_nil users(:julien).reset_password_sent_at
|
87
|
-
assert !users(:julien).valid_password?(@attributes[:password])
|
88
|
-
end
|
89
|
-
|
90
|
-
test "should not update without token" do
|
91
|
-
put :update, :user => @attributes
|
92
|
-
assert_redirected_to root_url
|
93
|
-
assert flash[:alert]
|
94
|
-
end
|
95
|
-
|
96
|
-
test "should not update with bad token" do
|
97
|
-
put :update, :user => @attributes.merge(:reset_password_token => "zeouraprsoghpzçtusfgyzmpfojfjbsodifs")
|
98
|
-
assert_redirected_to root_url
|
99
|
-
assert flash[:alert]
|
100
|
-
end
|
101
|
-
end
|
@@ -1,112 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
class Users::RegistrationsControllerTest < ActionController::TestCase
|
4
|
-
test "should get new" do
|
5
|
-
get :new
|
6
|
-
assert_response :ok
|
7
|
-
assert_select '#user_email'
|
8
|
-
assert_select '#user_password'
|
9
|
-
assert_select '#user_password_confirmation'
|
10
|
-
end
|
11
|
-
|
12
|
-
test "should create" do
|
13
|
-
assert_email do
|
14
|
-
post :create, :user => { :email => 'toto@example.com', :password => 'my secret' }
|
15
|
-
assert_redirected_to user_url
|
16
|
-
assert_authenticated(:user)
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
test "should create with password confirmation" do
|
21
|
-
assert_email do
|
22
|
-
post :create, :user => { :email => 'toto@example.com', :password => 'my secret', :password_confirmation => 'my secret' }
|
23
|
-
assert_redirected_to user_url
|
24
|
-
assert_authenticated(:user)
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
test "should not create with bad confirmation" do
|
29
|
-
assert_no_email do
|
30
|
-
post :create, :user => { :email => 'toto@example.com', :password => 'my secret', :password_confirmation => 'blah' }
|
31
|
-
assert_response :ok
|
32
|
-
assert_template 'users/registrations/new'
|
33
|
-
end
|
34
|
-
|
35
|
-
assert_select '#error_explanation'
|
36
|
-
assert_select "#user_password", 1
|
37
|
-
assert_select "#user_password[value]", 0
|
38
|
-
assert_select "#user_password_confirmation", 1
|
39
|
-
assert_select "#user_password_confirmation[value]", 0
|
40
|
-
end
|
41
|
-
|
42
|
-
test "should get edit" do
|
43
|
-
sign_in users(:julien)
|
44
|
-
get :edit
|
45
|
-
assert_response :ok
|
46
|
-
assert_select '#user_email'
|
47
|
-
assert_select '#user_current_password'
|
48
|
-
assert_select '#user_password'
|
49
|
-
assert_select '#user_password_confirmation'
|
50
|
-
end
|
51
|
-
|
52
|
-
test "should update" do
|
53
|
-
sign_in users(:julien)
|
54
|
-
|
55
|
-
# assert_email do
|
56
|
-
put :update, :user => { :email => 'toto@example.com', :current_password => 'secret' }
|
57
|
-
assert_redirected_to user_url
|
58
|
-
# end
|
59
|
-
end
|
60
|
-
|
61
|
-
test "should update with blank passwords" do
|
62
|
-
sign_in users(:julien)
|
63
|
-
put :update, :user => { :email => 'toto@example.com', :current_password => 'secret',
|
64
|
-
:password => "", :password_confirmation => "" }
|
65
|
-
assert_redirected_to user_url
|
66
|
-
assert users(:julien).valid_password?('secret')
|
67
|
-
end
|
68
|
-
|
69
|
-
test "should not update without current_password" do
|
70
|
-
sign_in users(:julien)
|
71
|
-
put :update, :user => { :email => 'toto@example.com' }
|
72
|
-
assert_response :ok
|
73
|
-
assert_template 'users/registrations/edit'
|
74
|
-
assert_select '#error_explanation'
|
75
|
-
end
|
76
|
-
|
77
|
-
test "should not update with bad current_password" do
|
78
|
-
sign_in users(:julien)
|
79
|
-
put :update, :user => { :email => 'toto@example.com', :current_password => 'bad secret',
|
80
|
-
:password => "azerty", :password_confirmation => "azerty" }
|
81
|
-
assert_response :ok
|
82
|
-
assert_template 'users/registrations/edit'
|
83
|
-
assert_select '#error_explanation'
|
84
|
-
assert_select '#user_current_password'
|
85
|
-
assert_select '#user_current_password[value]', 0
|
86
|
-
assert_select '#user_password'
|
87
|
-
assert_select '#user_password[value]', 0
|
88
|
-
assert_select '#user_password_confirmation'
|
89
|
-
assert_select '#user_password_confirmation[value]', 0
|
90
|
-
end
|
91
|
-
|
92
|
-
test "should destroy" do
|
93
|
-
sign_in users(:julien)
|
94
|
-
delete :destroy
|
95
|
-
assert_redirected_to root_url
|
96
|
-
end
|
97
|
-
|
98
|
-
test "anonymous should not get edit" do
|
99
|
-
get :edit
|
100
|
-
assert_redirected_to new_user_session_url
|
101
|
-
end
|
102
|
-
|
103
|
-
test "anonymous should not update" do
|
104
|
-
put :update, :user => { :email => 'toto@example.com', :current_password => 'bad secret' }
|
105
|
-
assert_redirected_to new_user_session_url
|
106
|
-
end
|
107
|
-
|
108
|
-
test "anonymous should not destroy" do
|
109
|
-
delete :destroy
|
110
|
-
assert_redirected_to new_user_session_url
|
111
|
-
end
|
112
|
-
end
|
@@ -1,100 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
class Users::SessionsControllerTest < ActionController::TestCase
|
4
|
-
setup do
|
5
|
-
@valid = { :email => users(:julien).email, :password => 'secret' }
|
6
|
-
end
|
7
|
-
|
8
|
-
test "should get new" do
|
9
|
-
get :new
|
10
|
-
assert_response :ok
|
11
|
-
assert_select '#user_email', 1
|
12
|
-
assert_select '#user_password', 1
|
13
|
-
assert_select 'input[name=return_to]', 0
|
14
|
-
end
|
15
|
-
|
16
|
-
test "new should define return_to to referer by default" do
|
17
|
-
request.env['HTTP_REFERER'] = "/some/path"
|
18
|
-
get :new
|
19
|
-
assert_response :ok
|
20
|
-
assert_select '#user_email', 1
|
21
|
-
assert_select '#user_password', 1
|
22
|
-
assert_select 'input[name=return_to][value=/some/path]', 1
|
23
|
-
end
|
24
|
-
|
25
|
-
test "new should pass return_to" do
|
26
|
-
get :new, :return_to => root_path
|
27
|
-
assert_response :ok
|
28
|
-
assert_select '#user_email', 1
|
29
|
-
assert_select '#user_password', 1
|
30
|
-
assert_select 'input[name=return_to][value=' + root_path + ']', 1
|
31
|
-
end
|
32
|
-
|
33
|
-
test "should create" do
|
34
|
-
post :create, :user => @valid
|
35
|
-
assert_redirected_to user_url
|
36
|
-
assert_authenticated(:user)
|
37
|
-
end
|
38
|
-
|
39
|
-
test "should create and redirect to given path" do
|
40
|
-
post :create, :user => @valid, :return_to => blog_path
|
41
|
-
assert_redirected_to blog_path
|
42
|
-
assert_authenticated(:user)
|
43
|
-
end
|
44
|
-
|
45
|
-
test "should create and redirect to given URL" do
|
46
|
-
post :create, :user => @valid, :return_to => root_url
|
47
|
-
assert_redirected_to root_url
|
48
|
-
assert_authenticated(:user)
|
49
|
-
end
|
50
|
-
|
51
|
-
test "create should not redirect to unknown host" do
|
52
|
-
post :create, :user => @valid, :return_to => root_url(:host => 'www.bad-host.com')
|
53
|
-
assert_redirected_to user_url
|
54
|
-
assert_authenticated(:user)
|
55
|
-
end
|
56
|
-
|
57
|
-
test "should fail to create without password" do
|
58
|
-
post :create, :user => { :email => users(:julien).email, :password => '' }
|
59
|
-
assert_response :unauthorized
|
60
|
-
assert_template 'users/sessions/new'
|
61
|
-
assert_select "#user_email[value='" + users(:julien).email + "']"
|
62
|
-
assert_select "#user_password[value='secret']", 0
|
63
|
-
assert_select '#error_explanation'
|
64
|
-
assert_not_authenticated(:user)
|
65
|
-
end
|
66
|
-
|
67
|
-
test "should fail to create with bad password" do
|
68
|
-
post :create, :user => { :email => users(:martha).email, :password => 'force me in' }
|
69
|
-
assert_response :unauthorized
|
70
|
-
assert_template 'users/sessions/new'
|
71
|
-
assert_select "#user_email[value='" + users(:martha).email + "']"
|
72
|
-
assert_select "#user_password[value='force me in']", 0
|
73
|
-
assert_select '#error_explanation'
|
74
|
-
assert_not_authenticated(:user)
|
75
|
-
end
|
76
|
-
|
77
|
-
test "should fail to create with unknown user" do
|
78
|
-
post :create, :user => { :email => 'nobody@localhost', :password => 'secret' }
|
79
|
-
assert_response :unauthorized
|
80
|
-
assert_template 'users/sessions/new'
|
81
|
-
assert_select "#user_email[value='nobody@localhost']"
|
82
|
-
assert_select "#user_password[value='secret']", 0
|
83
|
-
assert_select '#error_explanation'
|
84
|
-
assert_not_authenticated(:user)
|
85
|
-
end
|
86
|
-
|
87
|
-
test "should destroy" do
|
88
|
-
sign_in users(:julien)
|
89
|
-
|
90
|
-
get :destroy
|
91
|
-
assert_redirected_to root_url
|
92
|
-
assert_not_authenticated(:user)
|
93
|
-
end
|
94
|
-
|
95
|
-
test "destroy should silently logout anonymous" do
|
96
|
-
get :destroy
|
97
|
-
assert_redirected_to root_url
|
98
|
-
assert_not_authenticated(:user)
|
99
|
-
end
|
100
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
class UsersControllerTest < ActionController::TestCase
|
4
|
-
[:julien, :martha].each do |name|
|
5
|
-
test "#{name} should get show" do
|
6
|
-
sign_in users(name)
|
7
|
-
get :show
|
8
|
-
assert_response :ok
|
9
|
-
assert_select 'h1', 'Welcome ' + users(name).email
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
test "should not get show" do
|
14
|
-
get :show
|
15
|
-
assert_redirected_to new_user_session_url
|
16
|
-
end
|
17
|
-
|
18
|
-
test "should not get show as xml" do
|
19
|
-
get :show, :format => 'xml'
|
20
|
-
assert_response :unauthorized
|
21
|
-
end
|
22
|
-
end
|
@@ -1,32 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
class Users::RememberableTest < ActionDispatch::IntegrationTest
|
4
|
-
fixtures :all
|
5
|
-
|
6
|
-
test "should remember user across sessions" do
|
7
|
-
sign_in users(:julien), :remember_me => true
|
8
|
-
assert_authenticated
|
9
|
-
|
10
|
-
close_user_session
|
11
|
-
|
12
|
-
visit root_url
|
13
|
-
assert_authenticated
|
14
|
-
|
15
|
-
sign_out :user
|
16
|
-
visit root_url
|
17
|
-
assert_not_authenticated
|
18
|
-
end
|
19
|
-
|
20
|
-
test "registration should remember user" do
|
21
|
-
sign_up({ :email => 'toto@example.com', :password => 'my password' }, :scope => :user)
|
22
|
-
assert_authenticated
|
23
|
-
close_user_session
|
24
|
-
|
25
|
-
visit root_url
|
26
|
-
assert_authenticated
|
27
|
-
|
28
|
-
sign_out :user
|
29
|
-
visit root_url
|
30
|
-
assert_not_authenticated
|
31
|
-
end
|
32
|
-
end
|
@@ -1,72 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
class Users::RemoteTest < ActionDispatch::IntegrationTest
|
4
|
-
fixtures :all
|
5
|
-
|
6
|
-
test "service login" do
|
7
|
-
# user visits a remote site
|
8
|
-
visit blog_url(:host => 'test.host')
|
9
|
-
assert_not_authenticated
|
10
|
-
|
11
|
-
# user clicks the sign in link
|
12
|
-
click_link 'sign_in'
|
13
|
-
assert_match Regexp.new('^' + Regexp.quote(new_user_session_url(:return_to => '')) + '.+'), current_url
|
14
|
-
assert_select 'input[name=return_to]'
|
15
|
-
assert_select '#user_email'
|
16
|
-
assert_select '#user_password'
|
17
|
-
|
18
|
-
# user signs in and should be redirected to remote site
|
19
|
-
fill_in 'user_email', :with => users(:julien).email
|
20
|
-
fill_in 'user_password', :with => 'secret'
|
21
|
-
find('input[name=commit]').click
|
22
|
-
assert_match Regexp.new('^' + Regexp.quote(blog_url(:host => 'test.host', :remote_token => '')) + '.+'), current_url
|
23
|
-
|
24
|
-
# user should be authenticated on remote site
|
25
|
-
assert_authenticated
|
26
|
-
end
|
27
|
-
|
28
|
-
test "service login with signed in user" do
|
29
|
-
# user signs in on main site
|
30
|
-
sign_in users(:julien)
|
31
|
-
|
32
|
-
# user visits a remote site
|
33
|
-
visit blog_url(:host => 'test.host')
|
34
|
-
assert_not_authenticated
|
35
|
-
|
36
|
-
# user clicks the sign in link of remote site which should redirect her back
|
37
|
-
click_link 'sign_in'
|
38
|
-
assert_match Regexp.new('^' + Regexp.quote(blog_url(:host => 'test.host', :remote_token => '')) + '.+'), current_url
|
39
|
-
|
40
|
-
# user should have been transparently logged in
|
41
|
-
assert_authenticated
|
42
|
-
end
|
43
|
-
|
44
|
-
test "single sign out" do
|
45
|
-
# user signs in on main and remote site
|
46
|
-
sign_in users(:julien)
|
47
|
-
service_login :user, :return_to => root_url(:host => 'test.host')
|
48
|
-
|
49
|
-
# user signs out from main site
|
50
|
-
sign_out :user
|
51
|
-
|
52
|
-
# somebody visits the remote site using the user session
|
53
|
-
visit root_url(:host => 'test.host')
|
54
|
-
|
55
|
-
# session should have been invalidated
|
56
|
-
assert_not_authenticated
|
57
|
-
end
|
58
|
-
|
59
|
-
test "session invalidation should not reset the user session_token" do
|
60
|
-
sign_in users(:julien)
|
61
|
-
service_login :user, :return_to => root_url(:host => 'test.host')
|
62
|
-
|
63
|
-
sign_out :user
|
64
|
-
sign_in users(:julien)
|
65
|
-
|
66
|
-
visit root_url(:host => 'test.host')
|
67
|
-
assert_not_authenticated
|
68
|
-
|
69
|
-
visit root_url
|
70
|
-
assert_authenticated
|
71
|
-
end
|
72
|
-
end
|