Sha256: eaf87a9506789de87f1d0bb8b26aedf6164c537cdc014049ff63b446fb7f2ec4

Contents?: true

Size: 1.91 KB

Versions: 5

Compression:

Stored size: 1.91 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|
    expected = expected_value
    actual = @parsed_files[file - 1].feature.background.send(property.to_sym).to_s

    actual.should == expected
  end
end

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

  actual_description.should == expected_description
end

Then /^the(?: feature "([^"]*)")? background's steps are as follows:$/ do |file, steps|
  file ||= 1

  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.base
    end
  end

  expected = steps
  actual = actual_steps.flatten

  assert(actual == expected, "Expected: #{expected}\n but was: #{actual}")
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


Then(/^the(?: feature "([^"]*)")? background correctly stores its underlying implementation$/) do |file|
  file ||= 1

  raw_element = @parsed_files[file - 1].feature.background.raw_element

  expected = 'Background'
  actual = raw_element['keyword']

  assert(actual == expected, "Expected: #{expected}\n but was: #{actual}")
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
cucumber_analytics-1.4.2 features/step_definitions/background_steps.rb
cucumber_analytics-1.4.1 features/step_definitions/background_steps.rb
cucumber_analytics-1.4.0 features/step_definitions/background_steps.rb
cucumber_analytics-1.3.0 features/step_definitions/background_steps.rb
cucumber_analytics-1.2.0 features/step_definitions/background_steps.rb