Added tests for AccountController#register POST with automatic registration.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3904 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
5c525f0b41
commit
d3158e37b9
|
@ -175,5 +175,47 @@ class AccountControllerTest < ActionController::TestCase
|
|||
should_redirect_to('/') { home_url }
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
# See integration/account_test.rb for the full test
|
||||
context "POST #register" do
|
||||
context "with self registration on automatic" do
|
||||
setup do
|
||||
Setting.self_registration = '3'
|
||||
post :register, :user => {
|
||||
:login => 'register',
|
||||
:password => 'test',
|
||||
:password_confirmation => 'test',
|
||||
:firstname => 'John',
|
||||
:lastname => 'Doe',
|
||||
:mail => 'register@example.com'
|
||||
}
|
||||
end
|
||||
|
||||
should_respond_with :redirect
|
||||
should_assign_to :user
|
||||
should_redirect_to('my page') { {:controller => 'my', :action => 'account'} }
|
||||
|
||||
should "create a new user" do
|
||||
user = User.last(:conditions => {:login => 'register'})
|
||||
assert user
|
||||
assert_kind_of User, user
|
||||
end
|
||||
|
||||
should 'set the user status to active' do
|
||||
user = User.last(:conditions => {:login => 'register'})
|
||||
assert user
|
||||
assert_equal User::STATUS_ACTIVE, user.status
|
||||
end
|
||||
end
|
||||
|
||||
context "with self registration off" do
|
||||
setup do
|
||||
Setting.self_registration = '0'
|
||||
post :register
|
||||
end
|
||||
|
||||
should_redirect_to('/') { home_url }
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue