summaryrefslogtreecommitdiffstats
path: root/test/functional
diff options
context:
space:
mode:
authorEric Davis <edavis@littlestreamsoftware.com>2010-09-28 15:28:50 +0000
committerEric Davis <edavis@littlestreamsoftware.com>2010-09-28 15:28:50 +0000
commit3a3263102a7cda4be1c90168a9d32fa904d58272 (patch)
treebcd4ec938b2109caba6238d9bdc426c9ae335f5f /test/functional
parent79e30e7087d714ad81de83d389c37ae7d46d4dad (diff)
downloadredmine-3a3263102a7cda4be1c90168a9d32fa904d58272.tar.gz
redmine-3a3263102a7cda4be1c90168a9d32fa904d58272.zip
Refactor: split UsersController#add into #add and #create
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4215 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/functional')
-rw-r--r--test/functional/users_controller_test.rb42
1 files changed, 41 insertions, 1 deletions
diff --git a/test/functional/users_controller_test.rb b/test/functional/users_controller_test.rb
index 0e4c14c79..8e115eac6 100644
--- a/test/functional/users_controller_test.rb
+++ b/test/functional/users_controller_test.rb
@@ -24,7 +24,7 @@ class UsersController; def rescue_action(e) raise e end; end
class UsersControllerTest < ActionController::TestCase
include Redmine::I18n
- fixtures :users, :projects, :members, :member_roles, :roles
+ fixtures :users, :projects, :members, :member_roles, :roles, :auth_sources
def setup
@controller = UsersController.new
@@ -107,6 +107,46 @@ class UsersControllerTest < ActionController::TestCase
assert project_ids.include?(2) #private project admin can see
end
+ context "GET :add" do
+ setup do
+ get :add
+ end
+
+ should_assign_to :user
+ should_respond_with :success
+ should_render_template :add
+ end
+
+ context "POST :create" do
+ context "when successful" do
+ setup do
+ post :create, :user => {
+ :firstname => 'John',
+ :lastname => 'Doe',
+ :login => 'jdoe',
+ :password => 'test',
+ :password_confirmation => 'test',
+ :mail => 'jdoe@gmail.com'
+ }
+ end
+
+ should_assign_to :user
+ should_respond_with :redirect
+ should_redirect_to('user edit') { {:controller => 'users', :action => 'edit', :id => User.find_by_login('jdoe')}}
+ end
+
+ context "when unsuccessful" do
+ setup do
+ post :create, :user => {}
+ end
+
+ should_assign_to :user
+ should_respond_with :success
+ should_render_template :add
+ end
+
+ end
+
def test_edit
ActionMailer::Base.deliveries.clear
post :edit, :id => 2, :user => {:firstname => 'Changed'}