##// END OF EJS Templates
remove trailing white-spaces from test/functional/account_controller_test.rb....
Toshi MARUYAMA -
r5869:c9ba5662e842
parent child
Show More
@@ -1,16 +1,16
1 # redMine - project management software
2 # Copyright (C) 2006-2007 Jean-Philippe Lang
1 # Redmine - project management software
2 # Copyright (C) 2006-2011 Jean-Philippe Lang
3 3 #
4 4 # This program is free software; you can redistribute it and/or
5 5 # modify it under the terms of the GNU General Public License
6 6 # as published by the Free Software Foundation; either version 2
7 7 # of the License, or (at your option) any later version.
8 #
8 #
9 9 # This program is distributed in the hope that it will be useful,
10 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 12 # GNU General Public License for more details.
13 #
13 #
14 14 # You should have received a copy of the GNU General Public License
15 15 # along with this program; if not, write to the Free Software
16 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
@@ -23,20 +23,20 class AccountController; def rescue_action(e) raise e end; end
23 23
24 24 class AccountControllerTest < ActionController::TestCase
25 25 fixtures :users, :roles
26
26
27 27 def setup
28 28 @controller = AccountController.new
29 29 @request = ActionController::TestRequest.new
30 30 @response = ActionController::TestResponse.new
31 31 User.current = nil
32 32 end
33
33
34 34 def test_login_should_redirect_to_back_url_param
35 35 # request.uri is "test.host" in test environment
36 36 post :login, :username => 'jsmith', :password => 'jsmith', :back_url => 'http%3A%2F%2Ftest.host%2Fissues%2Fshow%2F1'
37 37 assert_redirected_to '/issues/show/1'
38 38 end
39
39
40 40 def test_login_should_not_redirect_to_another_host
41 41 post :login, :username => 'jsmith', :password => 'jsmith', :back_url => 'http%3A%2F%2Ftest.foo%2Ffake'
42 42 assert_redirected_to '/my/page'
@@ -50,9 +50,9 class AccountControllerTest < ActionController::TestCase
50 50 :attributes => { :class => "flash error" },
51 51 :content => /Invalid user or password/
52 52 end
53
53
54 54 if Object.const_defined?(:OpenID)
55
55
56 56 def test_login_with_openid_for_existing_user
57 57 Setting.self_registration = '3'
58 58 Setting.openid = '1'
@@ -73,7 +73,7 class AccountControllerTest < ActionController::TestCase
73 73 post :login, :openid_url => 'http;//openid.example.com/good_user'
74 74 assert_redirected_to home_url
75 75 end
76
76
77 77 def test_login_with_openid_for_existing_non_active_user
78 78 Setting.self_registration = '2'
79 79 Setting.openid = '1'
@@ -120,7 +120,7 class AccountControllerTest < ActionController::TestCase
120 120 token = Token.find_by_user_id_and_action(user.id, 'register')
121 121 assert token
122 122 end
123
123
124 124 def test_login_with_openid_with_new_user_created_with_manual_activation
125 125 Setting.self_registration = '2'
126 126 Setting.openid = '1'
@@ -130,30 +130,30 class AccountControllerTest < ActionController::TestCase
130 130 assert user
131 131 assert_equal User::STATUS_REGISTERED, user.status
132 132 end
133
133
134 134 def test_login_with_openid_with_new_user_with_conflict_should_register
135 135 Setting.self_registration = '3'
136 136 Setting.openid = '1'
137 137 existing_user = User.new(:firstname => 'Cool', :lastname => 'User', :mail => 'user@somedomain.com')
138 138 existing_user.login = 'cool_user'
139 139 assert existing_user.save!
140
140
141 141 post :login, :openid_url => 'http://openid.example.com/good_user'
142 142 assert_response :success
143 143 assert_template 'register'
144 144 assert assigns(:user)
145 145 assert_equal 'http://openid.example.com/good_user', assigns(:user)[:identity_url]
146 146 end
147
147
148 148 def test_setting_openid_should_return_true_when_set_to_true
149 149 Setting.openid = '1'
150 150 assert_equal true, Setting.openid?
151 151 end
152
152
153 153 else
154 154 puts "Skipping openid tests."
155 155 end
156
156
157 157 def test_logout
158 158 @request.session[:user_id] = 2
159 159 get :logout
@@ -167,12 +167,12 class AccountControllerTest < ActionController::TestCase
167 167 Setting.self_registration = '3'
168 168 get :register
169 169 end
170
170
171 171 should_respond_with :success
172 172 should_render_template :register
173 173 should_assign_to :user
174 174 end
175
175
176 176 context "with self registration off" do
177 177 setup do
178 178 Setting.self_registration = '0'
@@ -197,7 +197,7 class AccountControllerTest < ActionController::TestCase
197 197 :mail => 'register@example.com'
198 198 }
199 199 end
200
200
201 201 should_respond_with :redirect
202 202 should_assign_to :user
203 203 should_redirect_to('my page') { {:controller => 'my', :action => 'account'} }
@@ -210,7 +210,7 class AccountControllerTest < ActionController::TestCase
210 210 assert_equal User::STATUS_ACTIVE, user.status
211 211 end
212 212 end
213
213
214 214 context "with self registration off" do
215 215 setup do
216 216 Setting.self_registration = '0'
@@ -220,5 +220,4 class AccountControllerTest < ActionController::TestCase
220 220 should_redirect_to('/') { home_url }
221 221 end
222 222 end
223
224 223 end
General Comments 0
You need to be logged in to leave comments. Login now