@@ -175,5 +175,47 class AccountControllerTest < ActionController::TestCase | |||
|
175 | 175 | should_redirect_to('/') { home_url } |
|
176 | 176 | end |
|
177 | 177 | end |
|
178 | ||
|
178 | ||
|
179 | # See integration/account_test.rb for the full test | |
|
180 | context "POST #register" do | |
|
181 | context "with self registration on automatic" do | |
|
182 | setup do | |
|
183 | Setting.self_registration = '3' | |
|
184 | post :register, :user => { | |
|
185 | :login => 'register', | |
|
186 | :password => 'test', | |
|
187 | :password_confirmation => 'test', | |
|
188 | :firstname => 'John', | |
|
189 | :lastname => 'Doe', | |
|
190 | :mail => 'register@example.com' | |
|
191 | } | |
|
192 | end | |
|
193 | ||
|
194 | should_respond_with :redirect | |
|
195 | should_assign_to :user | |
|
196 | should_redirect_to('my page') { {:controller => 'my', :action => 'account'} } | |
|
197 | ||
|
198 | should "create a new user" do | |
|
199 | user = User.last(:conditions => {:login => 'register'}) | |
|
200 | assert user | |
|
201 | assert_kind_of User, user | |
|
202 | end | |
|
203 | ||
|
204 | should 'set the user status to active' do | |
|
205 | user = User.last(:conditions => {:login => 'register'}) | |
|
206 | assert user | |
|
207 | assert_equal User::STATUS_ACTIVE, user.status | |
|
208 | end | |
|
209 | end | |
|
210 | ||
|
211 | context "with self registration off" do | |
|
212 | setup do | |
|
213 | Setting.self_registration = '0' | |
|
214 | post :register | |
|
215 | end | |
|
216 | ||
|
217 | should_redirect_to('/') { home_url } | |
|
218 | end | |
|
219 | end | |
|
220 | ||
|
179 | 221 | end |
General Comments 0
You need to be logged in to leave comments.
Login now