summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Davis <edavis@littlestreamsoftware.com>2010-08-19 04:29:51 +0000
committerEric Davis <edavis@littlestreamsoftware.com>2010-08-19 04:29:51 +0000
commitc731d1120914583e226b9bc315900c72767619cb (patch)
treea53e4def319c241d20d6e967a3755599473b6338
parent8458dc23d4b89d6f42bf356d9589753f1f0908e5 (diff)
downloadredmine-c731d1120914583e226b9bc315900c72767619cb.tar.gz
redmine-c731d1120914583e226b9bc315900c72767619cb.zip
Merged r3904 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/1.0-stable@3954 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r--test/functional/account_controller_test.rb44
1 files changed, 43 insertions, 1 deletions
diff --git a/test/functional/account_controller_test.rb b/test/functional/account_controller_test.rb
index ce3d13f10..61ad97430 100644
--- a/test/functional/account_controller_test.rb
+++ b/test/functional/account_controller_test.rb
@@ -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