diff options
-rw-r--r-- | test/unit/custom_field_user_format_test.rb | 18 |
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("") |