Sha256: 170cb0b35bb05989fed83581cdfdd383fe35ed2e1fc03ce5d328c9f4fcf82b3a

Contents?: true

Size: 1.64 KB

Versions: 1

Compression:

Stored size: 1.64 KB

Contents

Given(/^a copy job$/) do
  @job_dir = 'Documents'
  @job = File.join(@job_dir, 'copy.json')
  content = {
    'type' => 'copy',
    'file' => @letter,
    'recipient' => 'Dr. Hasenbein',
    'patient_first_name' => 'Chuck',
    'patient_last_name' => 'Norris',
    'patient_date_of_birth' => '1940-03-10'
  }
  create_dir(@job_dir)
  write_file(@job, content.to_json)
end

Given(/^an output folder$/) do
  @output_dir = 'export'
  create_dir(@output_dir)
end


When(/^I run postman with output dir$/) do
  cmd = "postman --jobdir Documents --outdir '#{@output_dir}'"
  run_simple(unescape(cmd))
end

When(/^I run postman with output dir in noop mode$/) do
  cmd = "postman --jobdir Documents --outdir '#{@output_dir}' --noop"
  run_simple(unescape(cmd))
end

When(/^I run postman with output dir from config file$/) do
  content = ''
  content << "jobdir 'Documents'\n"
  content << "outdir '#{@output_dir}'\n"
  write_file('config.rb', content)
  cmd = "postman --config 'config.rb'"
  run_simple(unescape(cmd))
end


Then(/^the letter should have been copied$/) do
  @output_file = 'Norris_Chuck_1940-03-10_792e.pdf' # Output file with fingerprint
  copied_letter = File.join(@output_dir, @output_file)
  check_file_presence([copied_letter], true)
end

Then(/^the letter should not have been copied$/) do
  @output_file = 'Norris_Chuck_1940-03-10_792e.pdf' # Output file with fingerprint
  copied_letter = File.join(@output_dir, File.basename(@letter))
  check_file_presence([copied_letter], false)
end

Then(/^the copy should have been logged$/) do
  [
    'Letter delivered',
    @job,
    @output_file
  ].each { |expected| assert_partial_output(expected, all_output) }
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
wicoris-postman-0.10.0 features/step_definitions/copy_steps.rb