Sha256: 2bfa3e23d14f22b414968c28e9e6911bc7424be5ddf6bbcafe7d6e689959a63c

Contents?: true

Size: 904 Bytes

Versions: 23

Compression:

Stored size: 904 Bytes

Contents

# frozen_string_literal: true

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

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

      def bind_time_tracker
        ::Spinach.hooks.before_scenario do |scenario_data, step_definitions|
          KnapsackPro.tracker.current_test_path = KnapsackPro::Adapters::SpinachAdapter.test_path(scenario_data)
          KnapsackPro.tracker.start_timer
        end

        ::Spinach.hooks.after_scenario do
          KnapsackPro.tracker.stop_timer
        end

        ::Spinach.hooks.after_run do
          KnapsackPro.logger.debug(KnapsackPro::Presenter.global_time)
        end
      end

      def bind_save_report(latest_error = nil)
        ::Spinach.hooks.after_run do
          KnapsackPro::Report.save
        end
      end
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
knapsack_pro-7.13.0 lib/knapsack_pro/adapters/spinach_adapter.rb
knapsack_pro-7.12.1 lib/knapsack_pro/adapters/spinach_adapter.rb
knapsack_pro-7.12.0 lib/knapsack_pro/adapters/spinach_adapter.rb
knapsack_pro-7.11.0 lib/knapsack_pro/adapters/spinach_adapter.rb
knapsack_pro-7.10.0 lib/knapsack_pro/adapters/spinach_adapter.rb
knapsack_pro-7.9.0 lib/knapsack_pro/adapters/spinach_adapter.rb
knapsack_pro-7.8.2 lib/knapsack_pro/adapters/spinach_adapter.rb
knapsack_pro-7.8.1 lib/knapsack_pro/adapters/spinach_adapter.rb
knapsack_pro-7.8.0 lib/knapsack_pro/adapters/spinach_adapter.rb
knapsack_pro-7.7.0 lib/knapsack_pro/adapters/spinach_adapter.rb
knapsack_pro-7.6.2 lib/knapsack_pro/adapters/spinach_adapter.rb
knapsack_pro-7.6.1 lib/knapsack_pro/adapters/spinach_adapter.rb
knapsack_pro-7.6.0 lib/knapsack_pro/adapters/spinach_adapter.rb
knapsack_pro-7.1.0 lib/knapsack_pro/adapters/spinach_adapter.rb
knapsack_pro-7.0.1 lib/knapsack_pro/adapters/spinach_adapter.rb
knapsack_pro-7.0.0 lib/knapsack_pro/adapters/spinach_adapter.rb
knapsack_pro-6.0.4 lib/knapsack_pro/adapters/spinach_adapter.rb
knapsack_pro-6.0.3 lib/knapsack_pro/adapters/spinach_adapter.rb
knapsack_pro-6.0.2 lib/knapsack_pro/adapters/spinach_adapter.rb
knapsack_pro-6.0.1 lib/knapsack_pro/adapters/spinach_adapter.rb