Commit e0af7384 authored by marutosijp's avatar marutosijp

code layout cleanup test/unit/custom_field_test.rb

git-svn-id: https://svn.redmine.org/redmine/trunk@16678 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent ab6e928a
......@@ -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!
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment