Sha256: 5ef7c71014fb6a46d3797e1d8cf76ced4e35e8e0bdb824dc592ac928646269a8

Contents?: true

Size: 1.62 KB

Versions: 8

Compression:

Stored size: 1.62 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
  ].each { |expected| assert_partial_output(expected, all_output) }
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
wicoris-postman-0.13.0 features/step_definitions/copy_steps.rb
wicoris-postman-0.12.2 features/step_definitions/copy_steps.rb
wicoris-postman-0.12.1 features/step_definitions/copy_steps.rb
wicoris-postman-0.12.0 features/step_definitions/copy_steps.rb
wicoris-postman-0.11.3 features/step_definitions/copy_steps.rb
wicoris-postman-0.11.2 features/step_definitions/copy_steps.rb
wicoris-postman-0.11.1 features/step_definitions/copy_steps.rb
wicoris-postman-0.11.0 features/step_definitions/copy_steps.rb