Sha256: c0d456ad8abb6692c6a5dc17674d1a12afc98000b79682fc4f73296d070ae955

Contents?: true

Size: 1.67 KB

Versions: 19

Compression:

Stored size: 1.67 KB

Contents

module KnapsackPro
  module Adapters
    class BaseAdapter
      # Just example, please overwrite constant in subclass
      TEST_DIR_PATTERN = 'test/**{,/*/**}/*_test.rb'

      def self.slow_test_file?(adapter_class, test_file_path)
        @slow_test_file_paths ||=
          begin
            slow_test_files =
              if KnapsackPro::Config::Env.slow_test_file_pattern
                KnapsackPro::TestFileFinder.slow_test_files_by_pattern(adapter_class)
              else
                # get slow test files from JSON file based on data from API
                KnapsackPro::SlowTestFileDeterminer.read_from_json_report
              end
            KnapsackPro::TestFilePresenter.paths(slow_test_files)
          end
        clean_path = KnapsackPro::TestFileCleaner.clean(test_file_path)
        @slow_test_file_paths.include?(clean_path)
      end

      def self.bind
        adapter = new
        adapter.bind
        adapter
      end

      def bind
        if KnapsackPro::Config::Env.recording_enabled?
          KnapsackPro.logger.debug('Test suite time execution recording enabled.')
          bind_time_tracker
          bind_save_report
        end

        if KnapsackPro::Config::Env.queue_recording_enabled?
          KnapsackPro.logger.debug('Test suite time execution queue recording enabled.')
          bind_queue_mode
        end
      end

      def bind_time_tracker
        raise NotImplementedError
      end

      def bind_save_report
        raise NotImplementedError
      end

      def bind_before_queue_hook
        raise NotImplementedError
      end

      def bind_queue_mode
        bind_before_queue_hook
        bind_time_tracker
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
knapsack_pro-2.10.1 lib/knapsack_pro/adapters/base_adapter.rb
knapsack_pro-2.10.0 lib/knapsack_pro/adapters/base_adapter.rb
knapsack_pro-2.9.0 lib/knapsack_pro/adapters/base_adapter.rb
knapsack_pro-2.8.0 lib/knapsack_pro/adapters/base_adapter.rb
knapsack_pro-2.7.0 lib/knapsack_pro/adapters/base_adapter.rb
knapsack_pro-2.6.0 lib/knapsack_pro/adapters/base_adapter.rb
knapsack_pro-2.5.0 lib/knapsack_pro/adapters/base_adapter.rb
knapsack_pro-2.4.0 lib/knapsack_pro/adapters/base_adapter.rb
knapsack_pro-2.3.0 lib/knapsack_pro/adapters/base_adapter.rb
knapsack_pro-2.2.1 lib/knapsack_pro/adapters/base_adapter.rb
knapsack_pro-2.2.0 lib/knapsack_pro/adapters/base_adapter.rb
knapsack_pro-2.1.1 lib/knapsack_pro/adapters/base_adapter.rb
knapsack_pro-2.1.0 lib/knapsack_pro/adapters/base_adapter.rb
knapsack_pro-2.0.0 lib/knapsack_pro/adapters/base_adapter.rb
knapsack_pro-1.22.3 lib/knapsack_pro/adapters/base_adapter.rb
knapsack_pro-1.22.2 lib/knapsack_pro/adapters/base_adapter.rb
knapsack_pro-1.22.1 lib/knapsack_pro/adapters/base_adapter.rb
knapsack_pro-1.22.0 lib/knapsack_pro/adapters/base_adapter.rb
knapsack_pro-1.21.0 lib/knapsack_pro/adapters/base_adapter.rb