@@ -43,6 +43,24 class CustomFieldUserFormatTest < ActiveSupport::TestCase | |||
|
43 | 43 | assert_equal (projects.first.users & projects.last.users).sort.map {|u| [u.name, u.id.to_s]}, possible_values_options |
|
44 | 44 | end |
|
45 | 45 | |
|
46 | def test_possible_custom_value_options_should_not_include_locked_users | |
|
47 | custom_value = CustomValue.new(:customized => Issue.find(1), :custom_field => @field) | |
|
48 | assert_include '2', @field.possible_custom_value_options(custom_value).map(&:last) | |
|
49 | ||
|
50 | assert User.find(2).lock! | |
|
51 | assert_not_include '2', @field.possible_custom_value_options(custom_value).map(&:last) | |
|
52 | end | |
|
53 | ||
|
54 | def test_possible_custom_value_options_should_include_user_that_was_assigned_to_the_custom_value | |
|
55 | user = User.generate! | |
|
56 | custom_value = CustomValue.new(:customized => Issue.find(1), :custom_field => @field) | |
|
57 | assert_not_include user.id.to_s, @field.possible_custom_value_options(custom_value).map(&:last) | |
|
58 | ||
|
59 | custom_value.value = user.id | |
|
60 | custom_value.save! | |
|
61 | assert_include user.id.to_s, @field.possible_custom_value_options(custom_value).map(&:last) | |
|
62 | end | |
|
63 | ||
|
46 | 64 | def test_cast_blank_value |
|
47 | 65 | assert_equal nil, @field.cast_value(nil) |
|
48 | 66 | assert_equal nil, @field.cast_value("") |
General Comments 0
You need to be logged in to leave comments.
Login now