From adee6de1404f4ae8243a9373412dc06965fc5cb7 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Wed, 4 Apr 2007 17:52:07 +0000 Subject: [PATCH] Added a unit test on User#role_for_project git-svn-id: http://redmine.rubyforge.org/svn/trunk@417 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- test/unit/user_test.rb | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/test/unit/user_test.rb b/test/unit/user_test.rb index 10aafa58..66cd7247 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