Added a unit test on User#role_for_project

git-svn-id: http://redmine.rubyforge.org/svn/trunk@417 e93f8b46-1217-0410-a6f0-8f06a7374b81
pull/351/head
Jean-Philippe Lang 18 years ago
parent 4ed89dc2d3
commit adee6de140
  1. 13
      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

Loading…
Cancel
Save