Sha256: b1f06eade68589973caa289154cf8eeffcebebfd1f688902166c1f86a7ff9955

Contents?: true

Size: 1.08 KB

Versions: 5

Compression:

Stored size: 1.08 KB

Contents

module KnapsackPro
  module Adapters
    class CucumberAdapter < BaseAdapter
      TEST_DIR_PATTERN = 'features/**{,/*/**}/*.feature'

      def self.test_path(scenario_or_outline_table)
        if scenario_or_outline_table.respond_to?(:file)
          scenario_or_outline_table.file
        else
          scenario_or_outline_table.scenario_outline.file
        end
      end

      def bind_time_tracker
        Around do |scenario_or_outline_table, block|
          KnapsackPro.tracker.current_test_path = KnapsackPro::Adapters::CucumberAdapter.test_path(scenario_or_outline_table)
          KnapsackPro.tracker.start_timer
          block.call
          KnapsackPro.tracker.stop_timer
        end

        ::Kernel.at_exit do
          KnapsackPro.logger.info(KnapsackPro::Presenter.global_time)
        end
      end

      def bind_save_report
        ::Kernel.at_exit do
          KnapsackPro::Report.save
        end
      end

      private

      def Around(*tag_expressions, &proc)
        ::Cucumber::RbSupport::RbDsl.register_rb_hook('around', tag_expressions, proc)
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
knapsack_pro-0.5.0 lib/knapsack_pro/adapters/cucumber_adapter.rb
knapsack_pro-0.4.0 lib/knapsack_pro/adapters/cucumber_adapter.rb
knapsack_pro-0.3.0 lib/knapsack_pro/adapters/cucumber_adapter.rb
knapsack_pro-0.2.1 lib/knapsack_pro/adapters/cucumber_adapter.rb
knapsack_pro-0.2.0 lib/knapsack_pro/adapters/cucumber_adapter.rb