summaryrefslogtreecommitdiffstats
path: root/test/unit/group_test.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2014-12-03 20:21:03 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2014-12-03 20:21:03 +0000
commit5222650d952390d3435848397a46d8aa1dbda09e (patch)
tree6ef084faa30f3bba0d0d1e361247f86c1f4da21d /test/unit/group_test.rb
parent1059f9a99ec41a8e320d4d66684e65d183270920 (diff)
downloadredmine-5222650d952390d3435848397a46d8aa1dbda09e.tar.gz
redmine-5222650d952390d3435848397a46d8aa1dbda09e.zip
Adds a few tests.
git-svn-id: http://svn.redmine.org/redmine/trunk@13695 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/group_test.rb')
-rw-r--r--test/unit/group_test.rb26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/unit/group_test.rb b/test/unit/group_test.rb
index d2f09f9a7..6989680ec 100644
--- a/test/unit/group_test.rb
+++ b/test/unit/group_test.rb
@@ -132,4 +132,30 @@ class GroupTest < ActiveSupport::TestCase
assert_equal nil, Issue.find(1).assigned_to_id
end
+
+ def test_builtin_groups_should_be_created_if_missing
+ Group.delete_all
+
+ assert_difference 'Group.count', 2 do
+ group = Group.anonymous
+ assert_equal GroupAnonymous, group.class
+
+ group = Group.non_member
+ assert_equal GroupNonMember, group.class
+ end
+ end
+
+ def test_builtin_in_group_should_be_uniq
+ group = GroupAnonymous.new
+ group.name = 'Foo'
+ assert !group.save
+ end
+
+ def test_builtin_in_group_should_not_accept_users
+ group = Group.anonymous
+ assert_raise RuntimeError do
+ group.users << User.find(1)
+ end
+ assert_equal 0, group.reload.users.count
+ end
end