comparison test/functional/.svn/text-base/account_controller_test.rb.svn-base @ 14:1d32c0a0efbf

* Update to SVN trunk (revisions 3892-4040)
author Chris Cannam
date Wed, 25 Aug 2010 16:30:24 +0100
parents 513646585e45
children 94944d00e43c
comparison
equal deleted inserted replaced
4:9cc62779c13a 14:1d32c0a0efbf
65 65
66 post :login, :openid_url => existing_user.identity_url 66 post :login, :openid_url => existing_user.identity_url
67 assert_redirected_to 'my/page' 67 assert_redirected_to 'my/page'
68 end 68 end
69 69
70 def test_login_with_invalid_openid_provider
71 Setting.self_registration = '0'
72 Setting.openid = '1'
73 post :login, :openid_url => 'http;//openid.example.com/good_user'
74 assert_redirected_to home_url
75 end
76
70 def test_login_with_openid_for_existing_non_active_user 77 def test_login_with_openid_for_existing_non_active_user
71 Setting.self_registration = '2' 78 Setting.self_registration = '2'
72 Setting.openid = '1' 79 Setting.openid = '1'
73 existing_user = User.new(:firstname => 'Cool', 80 existing_user = User.new(:firstname => 'Cool',
74 :lastname => 'User', 81 :lastname => 'User',
151 @request.session[:user_id] = 2 158 @request.session[:user_id] = 2
152 get :logout 159 get :logout
153 assert_redirected_to '' 160 assert_redirected_to ''
154 assert_nil @request.session[:user_id] 161 assert_nil @request.session[:user_id]
155 end 162 end
163
164 context "GET #register" do
165 context "with self registration on" do
166 setup do
167 Setting.self_registration = '3'
168 get :register
169 end
170
171 should_respond_with :success
172 should_render_template :register
173 should_assign_to :user
174 end
175
176 context "with self registration off" do
177 setup do
178 Setting.self_registration = '0'
179 get :register
180 end
181
182 should_redirect_to('/') { home_url }
183 end
184 end
185
186 # See integration/account_test.rb for the full test
187 context "POST #register" do
188 context "with self registration on automatic" do
189 setup do
190 Setting.self_registration = '3'
191 post :register, :user => {
192 :login => 'register',
193 :password => 'test',
194 :password_confirmation => 'test',
195 :firstname => 'John',
196 :lastname => 'Doe',
197 :mail => 'register@example.com'
198 }
199 end
200
201 should_respond_with :redirect
202 should_assign_to :user
203 should_redirect_to('my page') { {:controller => 'my', :action => 'account'} }
204
205 should_create_a_new_user { User.last(:conditions => {:login => 'register'}) }
206
207 should 'set the user status to active' do
208 user = User.last(:conditions => {:login => 'register'})
209 assert user
210 assert_equal User::STATUS_ACTIVE, user.status
211 end
212 end
213
214 context "with self registration off" do
215 setup do
216 Setting.self_registration = '0'
217 post :register
218 end
219
220 should_redirect_to('/') { home_url }
221 end
222 end
223
156 end 224 end