Sha256: 3464d27283a129edd352791a3bd2d60fd55c8fc0938f158b150471340d2f624c

Contents?: true

Size: 795 Bytes

Versions: 23

Compression:

Stored size: 795 Bytes

Contents

# frozen_string_literal: true

module KnapsackPro
  module TestCaseMergers
    class BaseMerger
      # values must be string to avoid circular dependency problem during loading files
      ADAPTER_TO_MERGER_MAP = {
        KnapsackPro::Adapters::RSpecAdapter => 'KnapsackPro::TestCaseMergers::RSpecMerger',
      }

      def self.call(adapter_class, test_files)
        merger_class =
          ADAPTER_TO_MERGER_MAP[adapter_class] ||
          raise("Test case merger does not exist for adapter_class: #{adapter_class}")
        Kernel.const_get(merger_class).new(test_files).call
      end

      def initialize(test_files)
        @test_files = test_files
      end

      def call
        raise NotImplementedError
      end

      private

      attr_reader :test_files
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
knapsack_pro-6.0.0 lib/knapsack_pro/test_case_mergers/base_merger.rb
knapsack_pro-5.7.0 lib/knapsack_pro/test_case_mergers/base_merger.rb
knapsack_pro-5.6.0 lib/knapsack_pro/test_case_mergers/base_merger.rb