summaryrefslogtreecommitdiffstats
path: root/test/unit
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2014-12-06 11:19:54 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2014-12-06 11:19:54 +0000
commit9c173375c631508aabcf1e65db28605410cbb9e2 (patch)
treefdf222c17a4a9df9f288727934cc32c4fd8c802a /test/unit
parent5324fd04b19d1e894507e9f07d7424fcd808ee0a (diff)
downloadredmine-9c173375c631508aabcf1e65db28605410cbb9e2.tar.gz
redmine-9c173375c631508aabcf1e65db28605410cbb9e2.zip
Adds a test for #18584.
git-svn-id: http://svn.redmine.org/redmine/trunk@13722 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit')
-rw-r--r--test/unit/custom_field_user_format_test.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/unit/custom_field_user_format_test.rb b/test/unit/custom_field_user_format_test.rb
index e539c2ed1..aea43cf94 100644
--- a/test/unit/custom_field_user_format_test.rb
+++ b/test/unit/custom_field_user_format_test.rb
@@ -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
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
assert_equal nil, @field.cast_value(nil)
assert_equal nil, @field.cast_value("")