Sha256: 9a1cfbb3e99a521ae5d39ad5fd8fb068dd20b6872a358f31d863e9cf77022be0

Contents?: true

Size: 1.69 KB

Versions: 3

Compression:

Stored size: 1.69 KB

Contents

Then /^the(?: feature "([^"]*)")? background is found to have the following properties:$/ do |file, properties|
  file ||= 1
  properties = properties.rows_hash

  properties.each do |property, expected_value|
    assert { expected_value == @parsed_files[file - 1].feature.background.send(property.to_sym).to_s }
  end
end

Then /^the(?: feature "([^"]*)")? background's descriptive lines are as follows:$/ do |file, lines|
  file ||= 1
  expected_description = lines.raw.flatten

  assert { @parsed_files[file - 1].feature.background.description == expected_description }
end

Then /^the(?: feature "([^"]*)")? background's steps(?: "([^"]*)" arguments)?(?: "([^"]*)" keywords)? are as follows:$/ do |file, arguments, keywords, steps|
  file ||= 1
  arguments ||= 'with'
  keywords ||= 'with'
  translate = {'with' => true,
               'without' => false}

  options = {:with_keywords => translate[keywords], :with_arguments => translate[arguments]}

  steps = steps.raw.flatten.collect do |step|
    if step.start_with? "'"
      step.slice(1..step.length - 2)
    else
      step
    end
  end

  actual_steps = Array.new.tap do |steps|
    @parsed_files[file - 1].feature.background.steps.each do |step|
      steps << step.step_text(options)
    end
  end

  assert { actual_steps.flatten == steps }
end

When /^step "([^"]*)" of the background (?:of feature "([^"]*)" )?has the following block:$/ do |step, file, block|
  file ||= 1

  block = block.raw.flatten.collect do |line|
    if line.start_with? "'"
      line.slice(1..line.length - 2)
    else
      line
    end
  end

  assert { @parsed_files[file - 1].feature.background.steps[step - 1].block == block }
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
cucumber_analytics-0.0.3 features/step_definitions/background_steps.rb
cucumber_analytics-0.0.2 features/step_definitions/background_steps.rb
cucumber_analytics-0.0.1 features/step_definitions/background_steps.rb