features/step_definitions/remi_step.rb in remi-0.3.2 vs features/step_definitions/remi_step.rb in remi-0.3.3
- old
+ new
@@ -67,10 +67,18 @@
Then /^the file is uploaded to the remote path "([^"]+)"$/ do |remote_path|
expected_path = Remi::Testing::BusinessRules::ParseFormula.parse(remote_path)
expect(@brt.target.data_subject.loaders.map(&:remote_path)).to include expected_path
end
+Then /^the file is uploaded to the S3 bucket "([^"]+)"$/ do |bucket_name|
+ expected_bucket_name = Remi::Testing::BusinessRules::ParseFormula.parse(bucket_name)
+ bucket_names = @brt.target.data_subject.loaders.map do |loader|
+ loader.bucket_name if loader.respond_to? :bucket_name
+ end
+ expect(bucket_names).to include expected_bucket_name
+end
+
## CSV Options
Given /^the (source|target) file is delimited with a (\w+)$/ do |st, delimiter|
csv_subject = @brt.send(st.to_sym).data_subject.send(st == 'source' ? :parser : :encoder)
expect(csv_subject.csv_options[:col_sep]).to eq Remi::Testing::BusinessRules.csv_opt_map[delimiter]
@@ -122,10 +130,20 @@
@brt.run_transforms if st == 'target'
expect(@brt.send(st.to_sym).data_subject.df.vectors.to_a).to eq @brt.send(st.to_sym).fields.field_names
end
+Given /^the (source|target) file contains all of the following headers in no particular order:$/ do |st, table|
+ table.rows.each do |row|
+ field = row.first
+ step "the #{st} field '#{field}'"
+ end
+
+ @brt.run_transforms if st == 'target'
+ expect(@brt.send(st.to_sym).data_subject.df.vectors.to_a).to match_array @brt.send(st.to_sym).fields.field_names
+end
+
### Source
Given /^the source '([[:alnum:]\s\-_]+)'$/ do |arg|
@brt.add_source(arg)
end
@@ -258,10 +276,11 @@
Then /^the target field '([^']+)' has the label '([^']+)'$/ do |target_field, label|
step "the target field '#{target_field}'"
data_field = @brt.targets.fields.next
expect(data_field.metadata[:label]).to eq label
expect(data_field.name).to eq target_field
+
end
Then /^the target field '([^']+)' is copied from the source field$/ do |target_field|
@brt.sources.fields.each do |source_field|
step "the target field '#{target_field}' is copied from the source field '#{source_field.full_name}'"
@@ -777,6 +796,13 @@
end
Then /^the target '([[:alnum:]\s\-_]+)' has (\d+) record(?:s|) where '([[:alnum:]\s\-_]+)' is between (\d*\.?\d+) and (\d*\.?\d+)$/ do |target_name, nrecords, field_name, low_value, high_value|
@brt.run_transforms
expect(@brt.targets[target_name].where_between(field_name, low_value, high_value).size).to eq nrecords.to_i
+end
+
+Then /^the target field '([^']+)' (?:has|is set to) the multiline value$/ do |target_field, value|
+ step "the target field '#{target_field}'"
+ @brt.run_transforms
+ target_name, target_field_name = @brt.targets.parse_full_field(target_field)
+ expect(@brt.targets[target_name].fields[target_field_name].value).to eq Remi::Testing::BusinessRules::ParseFormula.parse(value)
end