features/step_definitions/remi_step.rb in remi-0.2.35 vs features/step_definitions/remi_step.rb in remi-0.2.36
- old
+ new
@@ -42,38 +42,27 @@
end
### Source file processing
Given /^files with names matching the pattern \/(.*)\/$/ do |pattern|
- @brt.filestore.pattern(Regexp.new(pattern))
+ expect(@brt.source.data_subject.extractor.pattern).to eq Regexp.new(pattern)
end
-Given /^files with names that do not match the pattern \/(.*)\/$/ do |pattern|
- @brt.filestore.anti_pattern(Regexp.new(pattern))
+Given /^download groups defined by the pattern \/(.*)\/$/ do |pattern|
+ expect(@brt.source.data_subject.extractor.group_by).to eq Regexp.new(pattern)
end
-Given /^files delivered within the last (\d+) hours$/ do |hours|
- @brt.filestore.delivered_since(Time.now - hours.to_i * 3600)
-end
-
-Given /^files were delivered more than (\d+) hours ago$/ do |hours|
- @brt.filestore.delivered_before(Time.now - hours.to_i * 3600)
-end
-
Then /^the file with the latest date stamp will be downloaded for processing$/ do
- @brt.filestore.generate
- @brt.source.mock_extractor(@brt.filestore)
- expect(@brt.source.extract).to match_array Array(@brt.filestore.latest)
+ expect(@brt.source.data_subject.extractor.most_recent_by).to eq :create_time
end
-Then /^files will be downloaded for processing$/ do
+Then /^all files matching the pattern will be downloaded for processing$/ do
+ expect(@brt.source.data_subject.extractor.most_recent_only).to eq false
end
-Then /^no files will be downloaded for processing$/ do
- @brt.filestore.generate
- @brt.source.mock_extractor(@brt.filestore)
- expect { @brt.source.extract }.to raise_error Remi::Extractor::SftpFile::FileNotFoundError
+Then /^the file that comes last in an alphanumeric sort by group will be downloaded for processing$/ do
+ expect(@brt.source.data_subject.extractor.most_recent_by).to eq :name
end
Then /^the file is uploaded to the remote path "([^"]+)"$/ do |remote_path|
expect(@brt.target.get_attrib(:remote_path)).to eq Remi::BusinessRules::ParseFormula.parse(remote_path)
end
@@ -145,9 +134,22 @@
end
Given /^the source field (?:has|is set to) the value "([^"]*)"$/ do |value|
@brt.sources.fields.each do |field|
step "the source field '#{field.full_name}' is set to the value \"#{value}\""
+ end
+end
+
+Given /^the source field '([^']+)' (?:has|is set to) the json value$/ do |source_field, value|
+ step "the source field '#{source_field}'"
+
+ source_name, source_field_name = @brt.sources.parse_full_field(source_field)
+ @brt.sources[source_name].fields[source_field_name].value = JSON.parse(value)
+end
+
+Given /^the source field (?:has|is set to) the json value$/ do |value|
+ @brt.sources.fields.each do |field|
+ step "the source field '#{field.full_name}' is set to the json value \"#{value}\""
end
end
When /^the source field '([^']+)' (?:has an empty value|is blank)$/ do |source_field|
step "the source field '#{source_field}'"