Sha256: 6f51748696b262fec1987dbee1d980056ebe7a07855e4177bf948a54b0166a56

Contents?: true

Size: 1.11 KB

Versions: 1

Compression:

Stored size: 1.11 KB

Contents

require 'spinach'

module Knapsack
  module Adapters
    class SpinachAdapter < BaseAdapter
      TEST_DIR_PATTERN = 'features/**{,/*/**}/*.feature'
      REPORT_PATH = 'knapsack_spinach_report.json'

      def bind_time_tracker
        Spinach.hooks.before_scenario do |scenario_data, step_definitions|
          Knapsack.tracker.test_path = SpinachAdapter.test_path(scenario_data)
          Knapsack.tracker.start_timer
        end

        Spinach.hooks.after_scenario do
          Knapsack.tracker.stop_timer
        end

        Spinach.hooks.after_run do
          Knapsack.logger.info(Presenter.global_time)
        end
      end

      def bind_report_generator
        Spinach.hooks.after_run do
          Knapsack.report.save
          Knapsack.logger.info(Presenter.report_details)
        end
      end

      def bind_time_offset_warning
        Spinach.hooks.after_run do
          Knapsack.logger.log(
            Presenter.time_offset_log_level,
            Presenter.time_offset_warning
          )
        end
      end

      def self.test_path(scenario)
        scenario.feature.filename
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
knapsack-1.11.0 lib/knapsack/adapters/spinach_adapter.rb