Sha256: c9d65b4a7fb17de7c5849e2db19cb7981a303a7622ed07100b5523e020da92b2

Contents?: true

Size: 991 Bytes

Versions: 1

Compression:

Stored size: 991 Bytes

Contents

Given(/^a fax job$/) do
  dir = 'Documents'
  @job = File.join(dir, 'example.json')
  content = {
    'type' => 'fax',
    'file' => @letter,
    'phone' => '0123456789'
  }
  create_dir(dir)
  write_file(@job, content.to_json)
end

Given(/^a doubled fax interface$/) do
  double_cmd('lp')
end

When(/^I run postman$/) do
  cmd = 'postman --jobdir Documents'
  run_simple(unescape(cmd))
end

When(/^I run postman in noop mode$/) do
  cmd = 'postman --jobdir Documents --noop'
  run_simple(unescape(cmd))
end

def fax_cmd
  cmd = "lp -d Fax -o phone=00123456789 \"#{@letter}\"".shellsplit
end

Then(/^the letter should have been faxed$/) do
  expect(history).to include(fax_cmd), history.to_pretty
end

Then(/^the letter should not have been faxed$/) do
  expect(history).to_not include(fax_cmd), history.to_pretty
end

Then(/^the fax should have been logged$/) do
  [
    'Letter delivered',
    @job,
    '0123456789'
  ].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/fax_steps.rb