1
0
mirror of https://github.com/meineerde/redmine.git synced 2025-12-22 16:31:12 +00:00

Adds a test for #18584.

git-svn-id: http://svn.redmine.org/redmine/trunk@13722 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2014-12-06 11:19:54 +00:00
parent 5324fd04b1
commit 9c173375c6

View File

@ -43,6 +43,24 @@ class CustomFieldUserFormatTest < ActiveSupport::TestCase
assert_equal (projects.first.users & projects.last.users).sort.map {|u| [u.name, u.id.to_s]}, possible_values_options assert_equal (projects.first.users & projects.last.users).sort.map {|u| [u.name, u.id.to_s]}, possible_values_options
end end
def test_possible_custom_value_options_should_not_include_locked_users
custom_value = CustomValue.new(:customized => Issue.find(1), :custom_field => @field)
assert_include '2', @field.possible_custom_value_options(custom_value).map(&:last)
assert User.find(2).lock!
assert_not_include '2', @field.possible_custom_value_options(custom_value).map(&:last)
end
def test_possible_custom_value_options_should_include_user_that_was_assigned_to_the_custom_value
user = User.generate!
custom_value = CustomValue.new(:customized => Issue.find(1), :custom_field => @field)
assert_not_include user.id.to_s, @field.possible_custom_value_options(custom_value).map(&:last)
custom_value.value = user.id
custom_value.save!
assert_include user.id.to_s, @field.possible_custom_value_options(custom_value).map(&:last)
end
def test_cast_blank_value def test_cast_blank_value
assert_equal nil, @field.cast_value(nil) assert_equal nil, @field.cast_value(nil)
assert_equal nil, @field.cast_value("") assert_equal nil, @field.cast_value("")