Sha256: d15dfd04ff0a1ab67b062876e06059d1c42747b7507d166835692806214a9103

Contents?: true

Size: 1.56 KB

Versions: 5

Compression:

Stored size: 1.56 KB

Contents

When /^I get help for "([^"]*)"$/ do |app_name|
  @app_name = app_name
  When %(I run `#{app_name} --help`)
end

Then /^the following options should be documented:$/ do |options|
  options.raw.each do |option|
    Then %(the option "#{option[0]}" should be documented)
  end
end

Then /^the option "([^"]*)" should be documented$/ do |option|
  Then %(the output should match /^\\s*#{option}\\s+\\w\\w\\w+/)
end

Then /^the banner should be present$/ do
  Then %(the output should match /Usage: #{@app_name}/)
end

Then /^the banner should document that this app takes options$/ do
  Then %(the output should match /\[options\]/)
  And %(the output should contain "Options")
end

Then /^the banner should document that this app's arguments are:$/ do |table|
  expected_arguments = table.raw.map { |row|
    option = row[0]
    option = "[#{option}]" if row[1] == 'optional' || row[1] == 'which is optional'
  }.join(' ')
  Then %(the output should contain "#{expected_arguments}")
end

Then /^the banner should document that this app takes no options$/ do
  Then %(the output should not contain "[options]")
  And %(the output should not contain "Options")
end

Then /^the banner should document that this app takes no arguments$/ do
  Then %(the output should match /Usage: #{@app_name}\\s*$/)
end

Then /^there should be a one line summary of what the app does$/ do
  output_lines = all_output.split(/\n/)
  output_lines.should have_at_least(3).items
  # [0] is our banner, which we've checked for
  output_lines[1].should match(/^\s*$/)
  output_lines[2].should match(/^\w\w+\s+\w\w+/)
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
methadone-0.3.2 lib/methadone/cucumber.rb
methadone-0.3.1 lib/methadone/cucumber.rb
methadone-0.3.0 lib/methadone/cucumber.rb
methadone-0.2.0 lib/methadone/cucumber.rb
methadone-0.1.0 lib/methadone/cucumber.rb