diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2015-03-01 13:23:52 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2015-03-01 13:23:52 +0000 |
commit | 8667505e23b99d5ed025f9f26d87f41eb4c64aa0 (patch) | |
tree | 99fd944fa48849e4a2ea43e87c9612b1c422c038 /test | |
parent | dbe05a000ab0072529d95eddd89e33cbd5fa97ec (diff) | |
download | redmine-8667505e23b99d5ed025f9f26d87f41eb4c64aa0.tar.gz redmine-8667505e23b99d5ed025f9f26d87f41eb4c64aa0.zip |
Don't validate custom fields that are not editable (#19193).
git-svn-id: http://svn.redmine.org/redmine/trunk@14045 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r-- | test/unit/issue_test.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/unit/issue_test.rb b/test/unit/issue_test.rb index 33635e7a5..7f3e9484d 100644 --- a/test/unit/issue_test.rb +++ b/test/unit/issue_test.rb @@ -860,6 +860,29 @@ class IssueTest < ActiveSupport::TestCase assert issue.save end + def test_required_custom_field_that_is_not_visible_for_the_user_should_not_be_required + CustomField.delete_all + field = IssueCustomField.generate!(:is_required => true, :visible => false, :role_ids => [1], :trackers => Tracker.all, :is_for_all => true) + user = User.generate! + User.add_to_project(user, Project.find(1), Role.find(2)) + + issue = Issue.new(:project_id => 1, :tracker_id => 1, :status_id => 1, + :subject => 'Required fields', :author => user) + assert_save issue + end + + def test_required_custom_field_that_is_visible_for_the_user_should_be_required + CustomField.delete_all + field = IssueCustomField.generate!(:is_required => true, :visible => false, :role_ids => [1], :trackers => Tracker.all, :is_for_all => true) + user = User.generate! + User.add_to_project(user, Project.find(1), Role.find(1)) + + issue = Issue.new(:project_id => 1, :tracker_id => 1, :status_id => 1, + :subject => 'Required fields', :author => user) + assert !issue.save + assert_include "#{field.name} cannot be blank", issue.errors.full_messages + end + def test_required_attribute_names_for_multiple_roles_should_intersect_rules WorkflowPermission.delete_all WorkflowPermission.create!(:old_status_id => 1, :tracker_id => 1, |