Code cleanup.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9715 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2012-05-25 20:43:18 +00:00
parent 59cbc68dde
commit aa18cd54c7
3 changed files with 34 additions and 9 deletions
+17
View File
@@ -20,6 +20,19 @@ require File.expand_path('../../test_helper', __FILE__)
class RoleTest < ActiveSupport::TestCase
fixtures :roles, :workflows
def test_sorted_scope
assert_equal Role.all.sort, Role.sorted.all
end
def test_givable_scope
assert_equal Role.all.reject(&:builtin?).sort, Role.givable.all
end
def test_builtin_scope
assert_equal Role.all.select(&:builtin?).sort, Role.builtin(true).all.sort
assert_equal Role.all.reject(&:builtin?).sort, Role.builtin(false).all.sort
end
def test_copy_workflows
source = Role.find(1)
assert_equal 90, source.workflows.size
@@ -57,6 +70,10 @@ class RoleTest < ActiveSupport::TestCase
assert_equal 'Non membre', Role.non_member.name
end
def test_find_all_givable
assert_equal Role.all.reject(&:builtin?).sort, Role.find_all_givable
end
context "#anonymous" do
should "return the anonymous role" do
role = Role.anonymous