Sha256: f21f368442e72447eac0830fec260a0353eeae80f4db13c84ca72850f710e070

Contents?: true

Size: 1.03 KB

Versions: 3

Compression:

Stored size: 1.03 KB

Contents

def parse_configtest_output( txt )
  rows = []; keys = nil
  first_line = true
  txt.each_line do |line|
    next if line =~ /[+-]+/
    if first_line
      keys = line.split('|').map(&:strip) - ['|', '']
      first_line = false
    else
      values = line.split('|').map(&:strip) - ['|', '']
      rows << Hash[keys.zip(values)]
    end
  end
  rows
end

Given(/^I use mode "(.*?)"$/) do |mode|
  @mode = mode
end

Given(/^config "(.*?)"$/) do |config|
  @config = config
end

Given(/^parameter "(.*?)"$/) do |args|
  @args = args
end

When(/^log(\d+)mail is run$/) do |arg1|
  @output = `bundle exec bin/log2mail.rb #{@mode} --config features/log2mail_configurations/#{@config} #{@args}`
  # puts @output.inspect
  # puts parse_configtest_output(@output).inspect
end

Then(/^the output should be:$/) do |table|
  # table is a Cucumber::Ast::Table
  table.map_headers!
  table.map_column!(:Settings) { |cell| cell.empty? ? nil : cell } \
    if table.hashes.first[:Settings]
  table.diff! parse_configtest_output(@output), :surplus_col => true
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
log2mail-0.0.1.pre4 features/step_definitions/log2mail_steps.rb
log2mail-0.0.1.pre3 features/step_definitions/log2mail_steps.rb
log2mail-0.0.1.pre2 features/step_definitions/log2mail_steps.rb