Sha256: 5dbcd36d6c4ed63dbebacc01e3370fbe45c1e294674d196742499bdce294514a

Contents?: true

Size: 1.05 KB

Versions: 2

Compression:

Stored size: 1.05 KB

Contents

module Retest
  class Command
    class MultipleTestsNotSupported < StandardError; end

    class Base
      def initialize(all: false, file_system: FileSystem, command: nil)
        @file_system = file_system
        @all = all
        @command = command
      end

      def clone(params = {})
        self.class.new(**{ all: all, file_system: file_system, command: command }.merge(params))
      end

      def has_changed?
        to_s.include?('<changed>')
      end

      def has_test?
        to_s.include?('<test>')
      end

      def changed_type?
        !has_test? && has_changed?
      end

      def test_type?
        has_test? && !has_changed?
      end

      def variable_type?
        has_test? && has_changed?
      end

      def hardcoded_type?
        !has_test? && !has_changed?
      end

      def to_s
        @command
      end

      def format_batch(*files)
        raise MultipleTestsNotSupported, "Multiple test files run not supported for '#{to_s}'"
      end

      private

      attr_reader :all, :file_system, :command
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
retest-2.0.0.pre5 lib/retest/command/base.rb
retest-2.0.0.pre4 lib/retest/command/base.rb