From bc47c95f17ecb5d5dc051a3f710256ab5844c7a8 Mon Sep 17 00:00:00 2001 From: Toshi MARUYAMA Date: Wed, 9 Dec 2020 14:12:08 +0000 Subject: [PATCH] shorten long line of test/unit/lib/redmine/field_format/version_field_format_test.rb git-svn-id: http://svn.redmine.org/redmine/trunk@20594 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- .../field_format/version_field_format_test.rb | 37 +++++++++++++------ 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/test/unit/lib/redmine/field_format/version_field_format_test.rb b/test/unit/lib/redmine/field_format/version_field_format_test.rb index 71910f919..4e42db69f 100644 --- a/test/unit/lib/redmine/field_format/version_field_format_test.rb +++ b/test/unit/lib/redmine/field_format/version_field_format_test.rb @@ -33,37 +33,52 @@ class Redmine::VersionFieldFormatTest < ActionView::TestCase end def test_version_status_should_reject_blank_values - field = IssueCustomField.new(:name => 'Foo', :field_format => 'version', :version_status => ["open", ""]) + field = IssueCustomField.new(:name => 'Foo', :field_format => 'version', + :version_status => ["open", ""]) field.save! assert_equal ["open"], field.version_status end def test_existing_values_should_be_valid - field = IssueCustomField.create!(:name => 'Foo', :field_format => 'version', :is_for_all => true, :trackers => Tracker.all) + field = IssueCustomField.create!(:name => 'Foo', :field_format => 'version', + :is_for_all => true, + :trackers => Tracker.all) project = Project.generate! version = Version.generate!(:project => project, :status => 'open') - issue = Issue.generate!(:project_id => project.id, :tracker_id => 1, :custom_field_values => {field.id => version.id}) - + issue = Issue.generate!(:project_id => project.id, :tracker_id => 1, + :custom_field_values => {field.id => version.id}) field.version_status = ["open"] field.save! issue = Issue.order('id DESC').first - assert_include [version.name, version.id.to_s], field.possible_custom_value_options(issue.custom_value_for(field)) + assert_include( + [version.name, version.id.to_s], + field.possible_custom_value_options(issue.custom_value_for(field)) + ) assert issue.valid? end def test_not_existing_values_should_be_invalid - field = IssueCustomField.create!(:name => 'Foo', :field_format => 'version', :is_for_all => true, :trackers => Tracker.all) + field = + IssueCustomField.create!(:name => 'Foo', :field_format => 'version', + :is_for_all => true, :trackers => Tracker.all) project = Project.generate! version = Version.generate!(:project => project, :status => 'closed') field.version_status = ["open"] field.save! - issue = Issue.new(:project_id => project.id, :tracker_id => 1, :custom_field_values => {field.id => version.id}) - assert_not_include [version.name, version.id.to_s], field.possible_custom_value_options(issue.custom_value_for(field)) + issue = Issue.new(:project_id => project.id, :tracker_id => 1, + :custom_field_values => {field.id => version.id}) + assert_not_include( + [version.name, version.id.to_s], + field.possible_custom_value_options(issue.custom_value_for(field)) + ) assert_equal false, issue.valid? - assert_include "Foo #{::I18n.t('activerecord.errors.messages.inclusion')}", issue.errors.full_messages.first + assert_include( + "Foo #{::I18n.t('activerecord.errors.messages.inclusion')}", + issue.errors.full_messages.first + ) end def test_possible_values_options_should_return_project_versions @@ -76,8 +91,8 @@ class Redmine::VersionFieldFormatTest < ActionView::TestCase def test_possible_values_options_should_return_system_shared_versions_without_project field = IssueCustomField.new(:field_format => 'version') - version = Version.generate!(:project => Project.find(1), :status => 'open', :sharing => 'system') - + version = Version.generate!(:project => Project.find(1), + :status => 'open', :sharing => 'system') expected = Version.visible.where(:sharing => 'system').sort.map(&:name) assert_include version.name, expected assert_equal expected, field.possible_values_options.map(&:first) -- 2.39.5