Refactor custom field step

pull/972/head
Till Breuer 11 years ago
parent 61783ce3ae
commit 933d60e9ee
  1. 13
      features/step_definitions/custom_field_steps.rb

@ -64,16 +64,11 @@ Given /^the work package "(.+?)" has the custom field "(.+?)" set to "(.+?)"$/ d
wp = InstanceFinder.find(WorkPackage, wp_name)
custom_field = InstanceFinder.find(WorkPackageCustomField, field_name)
set = false
custom_value = wp.custom_values.detect {|cv| cv.custom_field_id == custom_field.id}
wp.custom_values.each do |custom_value|
if custom_value.custom_field_id == custom_field.id then
set = true
custom_value.value = value
end
end
if !set then
if custom_value
custom_value.value = value
else
wp.custom_values.build(:custom_field => custom_field, :value => value)
end

Loading…
Cancel
Save