Sha256: 4974ed01638dec420ea978c88be767dc4f7c026d611db3a92f2f8f823dd4b8f9

Contents?: true

Size: 1.09 KB

Versions: 3

Compression:

Stored size: 1.09 KB

Contents

module Cucover
  module FeatureElementExtensions
    def reset_skipped_steps!
      return unless @steps
      @steps.each do |step|
        step.instance_variable_set("@skip_invoke", nil)
      end
    end
  end
end

module Cucover
  module ExampleRowExtensions
    include FeatureElementExtensions

    def file_colon_line
      "#{file}:#{line}"
    end

    def file
      @scenario_outline.file_colon_line.split(':').first
    end
  end
end

Cucover::Monkey.extend_every Cucumber::Ast::Scenario => Cucover::FeatureElementExtensions
Cucover::Monkey.extend_every Cucumber::Ast::OutlineTable::ExampleRow => Cucover::ExampleRowExtensions

Before do |scenario_or_table_row|
  scenario_or_table_row.reset_skipped_steps!

  Cucover.logger.info("Starting #{scenario_or_table_row.class} #{scenario_or_table_row.file_colon_line}")
  Cucover::Rails.patch_if_necessary

  if Cucover.should_execute?(scenario_or_table_row)
    Cucover.start_recording!(scenario_or_table_row)
  else
    announce "[ Cucover - Skipping clean scenario ]"
    scenario_or_table_row.skip_invoke!
  end
end

After do
  Cucover.stop_recording!
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
cucover-0.1.4 lib/cucover/cucumber_hooks.rb
cucover-0.1.3 lib/cucover/cucumber_hooks.rb
cucover-0.1.2 lib/cucover/cucumber_hooks.rb