From 2b24a617e16423966cfdf251af1743342729aa83 Mon Sep 17 00:00:00 2001 From: Toshi MARUYAMA Date: Mon, 19 Jun 2017 05:38:48 +0000 Subject: [PATCH] code layout cleanup test/unit/custom_field_test.rb git-svn-id: http://svn.redmine.org/redmine/trunk@16678 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- test/unit/custom_field_test.rb | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/test/unit/custom_field_test.rb b/test/unit/custom_field_test.rb index 461af85e4..1db16c2d4 100644 --- a/test/unit/custom_field_test.rb +++ b/test/unit/custom_field_test.rb @@ -55,7 +55,9 @@ class CustomFieldTest < ActiveSupport::TestCase end def test_default_value_should_not_be_validated_when_blank - field = CustomField.new(:name => 'Test', :field_format => 'list', :possible_values => ['a', 'b'], :is_required => true, :default_value => '') + field = CustomField.new(:name => 'Test', :field_format => 'list', + :possible_values => ['a', 'b'], :is_required => true, + :default_value => '') assert field.valid? end @@ -248,12 +250,18 @@ class CustomFieldTest < ActiveSupport::TestCase end def test_changing_multiple_to_false_should_delete_multiple_values - field = ProjectCustomField.create!(:name => 'field', :field_format => 'list', :multiple => 'true', :possible_values => ['field1', 'field2']) - other = ProjectCustomField.create!(:name => 'other', :field_format => 'list', :multiple => 'true', :possible_values => ['other1', 'other2']) - - item_with_multiple_values = Project.generate!(:custom_field_values => {field.id => ['field1', 'field2'], other.id => ['other1', 'other2']}) - item_with_single_values = Project.generate!(:custom_field_values => {field.id => ['field1'], other.id => ['other2']}) - + field = ProjectCustomField.create!(:name => 'field', :field_format => 'list', + :multiple => 'true', + :possible_values => ['field1', 'field2']) + other = ProjectCustomField.create!(:name => 'other', :field_format => 'list', + :multiple => 'true', + :possible_values => ['other1', 'other2']) + item_with_multiple_values = Project.generate!(:custom_field_values => + {field.id => ['field1', 'field2'], + other.id => ['other1', 'other2']}) + item_with_single_values = Project.generate!(:custom_field_values => + {field.id => ['field1'], + other.id => ['other2']}) assert_difference 'CustomValue.count', -1 do field.multiple = false field.save! -- 2.39.5