features/step_definitions/remi_step.rb in remi-0.2.22 vs features/step_definitions/remi_step.rb in remi-0.2.23
- old
+ new
@@ -308,10 +308,11 @@
@brt.run_transforms
expect(@brt.target.fields[target_field].value).to eq translation_row[1]
end
end
+
### Transforms
Then /^the target field '([^']+)' is a concatenation of the source fields '(.+)', delimited by "([^"]*)"$/ do |target_field, source_field_list, delimiter|
source_fields = "'#{source_field_list}'".gsub(' and ', ', ').split(',').map do |field_with_quotes|
full_field_name = field_with_quotes.match(/'(.+)'/)[1]
@@ -488,13 +489,50 @@
step "the source field '#{source_field}'"
source_name, source_field_name = @brt.sources.parse_full_field(source_field)
target_names, target_field_name = @brt.targets.parse_full_field(target_field, multi: true)
- truncated_source = @brt.sources[source_name].fields[source_field_name].value.slice(0, character_limit.to_i)
+ value = (@brt.sources[source_name].fields[source_field_name].value) * character_limit.to_i
+ @brt.sources[source_name].fields[source_field_name].value = value
+
+ truncated_source = value.slice(0, character_limit.to_i)
@brt.run_transforms
Array(target_names).each do |target_name|
expect(@brt.targets[target_name].fields[target_field_name].value).to eq truncated_source
+ end
+end
+
+Then /^the source field '([^']+)' is name-cased and loaded into the target field '([^']+)'$/ do |source_field, target_field|
+ step "the target field '#{target_field}'"
+ step "the source field '#{source_field}'"
+
+ source_name, source_field_name = @brt.sources.parse_full_field(source_field)
+ target_names, target_field_name = @brt.targets.parse_full_field(target_field, multi: true)
+
+ @brt.sources[source_name].fields[source_field_name].value = 'SCROOGE MCDUCK'
+ @brt.run_transforms
+ Array(target_names).each do |target_name|
+ expect(@brt.targets[target_name].fields[target_field_name].value).to eq 'Scrooge McDuck'
+ end
+end
+
+Then /^the source field is name-cased and loaded into the target field '([^']+)'$/ do |target_field|
+ @brt.sources.fields.each do |source_field|
+ step "the source field '#{source_field}' is name-cased and loaded into the target field '#{target_field}'"
+ end
+end
+
+Then /^the source field '([^']+)' is name-cased and loaded into the target field$/ do |source_field|
+ @brt.targets.fields.each do |target_field|
+ step "the source field '#{source_field}' is name-cased and loaded into the target field '#{target_field}'"
+ end
+end
+
+Then /^the source field is name-cased and loaded into the target field$/ do
+ @brt.targets.fields.each do |target_field|
+ @brt.sources.fields.each do |source_field|
+ step "the source field '#{source_field}' is name-cased and loaded into the target field '#{target_field}'"
+ end
end
end
### Field presence