class Retest::Runner::VariableRunner

Attributes

command[R]

Public Class Methods

new(command) click to toggle source
# File lib/retest/runner.rb, line 14
def initialize(command)
  @command = command
  @cached_test_file = nil
end

Public Instance Methods

==(obj) click to toggle source
# File lib/retest/runner.rb, line 19
def ==(obj)
  command == obj.command && obj.class == self.class
end
cached_test_file() click to toggle source
# File lib/retest/runner.rb, line 23
def cached_test_file
  @cached_test_file
end
cached_test_file=(value) click to toggle source
# File lib/retest/runner.rb, line 27
def cached_test_file=(value)
  @cached_test_file = value || @cached_test_file
end
matching?() click to toggle source
# File lib/retest/runner.rb, line 59
def matching?
  true
end
remove(purged) click to toggle source
# File lib/retest/runner.rb, line 45
def remove(purged)
  return if purged.empty?

  if purged.is_a? Array
    purge_cache if purged.include? cached_test_file
  elsif purged.is_a? String
    purge_cache if purged == cached_test_file
  end
end
run(test_file = nil) click to toggle source
# File lib/retest/runner.rb, line 31
      def run(test_file = nil)
        self.cached_test_file = test_file

        if cached_test_file
          puts "Test File Selected: #{cached_test_file}"
          system command.gsub('<test>', cached_test_file)
        else
          puts <<~ERROR
            404 - Test File Not Found
            Retest could not find a matching test file to run.
          ERROR
        end
      end
unmatching?() click to toggle source
# File lib/retest/runner.rb, line 55
def unmatching?
  !matching?
end

Private Instance Methods

purge_cache() click to toggle source
# File lib/retest/runner.rb, line 65
def purge_cache
  @cached_test_file = nil
end