diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2015-10-14 18:02:12 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2015-10-14 18:02:12 +0000 |
commit | f9668dfc0d56d03629ea6c10d51b04ab4ed717d6 (patch) | |
tree | 119b43c91955604e3bc05e9a2f23d388487a94ac /test/functional/issues_controller_test.rb | |
parent | ebdfe41cff3f2fbb634d89d449c5c9c76357cf47 (diff) | |
download | redmine-f9668dfc0d56d03629ea6c10d51b04ab4ed717d6.tar.gz redmine-f9668dfc0d56d03629ea6c10d51b04ab4ed717d6.zip |
List custom fields with multiple values set as required by workflow can be blank (#20677).
Patch by Pavel Rosický.
git-svn-id: http://svn.redmine.org/redmine/trunk@14670 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/functional/issues_controller_test.rb')
-rw-r--r-- | test/functional/issues_controller_test.rb | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/test/functional/issues_controller_test.rb b/test/functional/issues_controller_test.rb index 158ba4316..390da19a3 100644 --- a/test/functional/issues_controller_test.rb +++ b/test/functional/issues_controller_test.rb @@ -2169,6 +2169,31 @@ class IssuesControllerTest < ActionController::TestCase assert_select_error /Bar cannot be blank/i end + def test_create_should_validate_required_list_fields + cf1 = IssueCustomField.create!(:name => 'Foo', :field_format => 'list', :is_for_all => true, :tracker_ids => [1, 2], :multiple => false, :possible_values => ['a', 'b']) + cf2 = IssueCustomField.create!(:name => 'Bar', :field_format => 'list', :is_for_all => true, :tracker_ids => [1, 2], :multiple => true, :possible_values => ['a', 'b']) + WorkflowPermission.delete_all + WorkflowPermission.create!(:old_status_id => 1, :tracker_id => 2, :role_id => 1, :field_name => cf1.id.to_s, :rule => 'required') + WorkflowPermission.create!(:old_status_id => 1, :tracker_id => 2, :role_id => 1, :field_name => cf2.id.to_s, :rule => 'required') + @request.session[:user_id] = 2 + + assert_no_difference 'Issue.count' do + post :create, :project_id => 1, :issue => { + :tracker_id => 2, + :status_id => 1, + :subject => 'Test', + :start_date => '', + :due_date => '', + :custom_field_values => {cf1.id.to_s => '', cf2.id.to_s => ['']} + } + assert_response :success + assert_template 'new' + end + + assert_select_error /Foo cannot be blank/i + assert_select_error /Bar cannot be blank/i + end + def test_create_should_ignore_readonly_fields cf1 = IssueCustomField.create!(:name => 'Foo', :field_format => 'string', :is_for_all => true, :tracker_ids => [1, 2]) cf2 = IssueCustomField.create!(:name => 'Bar', :field_format => 'string', :is_for_all => true, :tracker_ids => [1, 2]) |