diff --git a/test/unit/user_test.rb b/test/unit/user_test.rb index 10aafa58ac..66cd724722 100644 --- a/test/unit/user_test.rb +++ b/test/unit/user_test.rb @@ -18,11 +18,12 @@ require File.dirname(__FILE__) + '/../test_helper' class UserTest < Test::Unit::TestCase - fixtures :users + fixtures :users, :members, :projects def setup @admin = User.find(1) @jsmith = User.find(2) + @dlopper = User.find(3) end def test_truth @@ -98,4 +99,14 @@ class UserTest < Test::Unit::TestCase @jsmith.reload assert_equal key.value, @jsmith.rss_key.value end + + def test_role_for_project + # user with a role + role = @jsmith.role_for_project(Project.find(1)) + assert_kind_of Role, role + assert_equal "Manager", role.name + + # user with no role + assert_nil @dlopper.role_for_project(Project.find(2)) + end end