Added a unit test on User#role_for_project
git-svn-id: http://redmine.rubyforge.org/svn/trunk@417 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
4ed89dc2d3
commit
adee6de140
|
@ -18,11 +18,12 @@
|
||||||
require File.dirname(__FILE__) + '/../test_helper'
|
require File.dirname(__FILE__) + '/../test_helper'
|
||||||
|
|
||||||
class UserTest < Test::Unit::TestCase
|
class UserTest < Test::Unit::TestCase
|
||||||
fixtures :users
|
fixtures :users, :members, :projects
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
@admin = User.find(1)
|
@admin = User.find(1)
|
||||||
@jsmith = User.find(2)
|
@jsmith = User.find(2)
|
||||||
|
@dlopper = User.find(3)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_truth
|
def test_truth
|
||||||
|
@ -98,4 +99,14 @@ class UserTest < Test::Unit::TestCase
|
||||||
@jsmith.reload
|
@jsmith.reload
|
||||||
assert_equal key.value, @jsmith.rss_key.value
|
assert_equal key.value, @jsmith.rss_key.value
|
||||||
end
|
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
|
end
|
||||||
|
|
Loading…
Reference in New Issue