summaryrefslogtreecommitdiffstats
path: root/test/functional/groups_controller_test.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2011-11-28 17:46:21 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2011-11-28 17:46:21 +0000
commit5c60a4f6ca92051850ec86a7cad6e12d2b7451ac (patch)
treee764f85caf8d7bbb171d9f80457dd152acb82537 /test/functional/groups_controller_test.rb
parent1d00ec11a08bed94f8b65adce82b048fb5ed1a15 (diff)
downloadredmine-5c60a4f6ca92051850ec86a7cad6e12d2b7451ac.tar.gz
redmine-5c60a4f6ca92051850ec86a7cad6e12d2b7451ac.zip
Adds functional tests for GroupsController.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@7968 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/functional/groups_controller_test.rb')
-rw-r--r--test/functional/groups_controller_test.rb24
1 files changed, 23 insertions, 1 deletions
diff --git a/test/functional/groups_controller_test.rb b/test/functional/groups_controller_test.rb
index c28ebbdea..158bf7d95 100644
--- a/test/functional/groups_controller_test.rb
+++ b/test/functional/groups_controller_test.rb
@@ -55,6 +55,9 @@ class GroupsControllerTest < ActionController::TestCase
post :create, :group => {:lastname => 'New group'}
end
assert_redirected_to '/groups'
+ group = Group.first(:order => 'id DESC')
+ assert_equal 'New group', group.name
+ assert_equal [], group.users
end
def test_create_and_continue
@@ -62,6 +65,16 @@ class GroupsControllerTest < ActionController::TestCase
post :create, :group => {:lastname => 'New group'}, :continue => 'Create and continue'
end
assert_redirected_to '/groups/new'
+ group = Group.first(:order => 'id DESC')
+ assert_equal 'New group', group.name
+ end
+
+ def test_create_with_failure
+ assert_no_difference 'Group.count' do
+ post :create, :group => {:lastname => ''}
+ end
+ assert_response :success
+ assert_template 'new'
end
def test_edit
@@ -71,8 +84,17 @@ class GroupsControllerTest < ActionController::TestCase
end
def test_update
- post :update, :id => 10
+ new_name = 'New name'
+ put :update, :id => 10, :group => {:lastname => new_name}
assert_redirected_to '/groups'
+ group = Group.find(10)
+ assert_equal new_name, group.name
+ end
+
+ def test_update_with_failure
+ put :update, :id => 10, :group => {:lastname => ''}
+ assert_response :success
+ assert_template 'edit'
end
def test_destroy