Parent

Files

Guard::Minitest::Runner

Attributes

inspector[RW]

Public Class Methods

new(options = {}) click to toggle source
# File lib/guard/minitest/runner.rb, line 8
def initialize(options = {})
  @options = {
    all_after_pass:     false,
    bundler:            File.exist?("#{Dir.pwd}/Gemfile"),
    rubygems:           false,
    drb:                false,
    zeus:               false,
    spring:             false,
    all_env:            {},
    env:                {},
    include:            [],
    test_folders:       ]test spec],
    test_file_patterns: ]*_test.rb test_*.rb *_spec.rb],
    cli:                nil,
    autorun:            true
  }.merge(options)

  parse_deprecated_options

  [:test_folders, :test_file_patterns].each do |k|
    @options[k] = Array(@options[k]).uniq.compact
  end

  @inspector = Inspector.new(test_folders, test_file_patterns)
end

Public Instance Methods

run(paths, options = {}) click to toggle source
# File lib/guard/minitest/runner.rb, line 34
def run(paths, options = {})
  return unless options[:all] || !paths.empty?

  message = "Running: #{options[:all] ? 'all tests' : paths.join(' ')}"
  UI.info message, reset: true

  status = _run_command(paths, options[:all])

  # When using zeus or spring, the Guard::Minitest::Reporter can't be used because the minitests run in another
  # process, but we can use the exit status of the client process to distinguish between :success and :failed.
  if zeus? || spring?
    ::Guard::Notifier.notify(message, title: 'Minitest results', image: status ? :success : :failed)
  end

  if @options[:all_after_pass] && status && !options[:all]
    run_all
  else
    status
  end
end
run_all() click to toggle source
# File lib/guard/minitest/runner.rb, line 55
def run_all
  paths = inspector.clean_all
  run(paths, all: true)
end
run_on_additions(paths) click to toggle source
# File lib/guard/minitest/runner.rb, line 65
def run_on_additions(paths)
  inspector.clear_memoized_test_files
  true
end
run_on_modifications(paths = []) click to toggle source
# File lib/guard/minitest/runner.rb, line 60
def run_on_modifications(paths = [])
  paths = inspector.clean(paths)
  run(paths, all: all_paths?(paths))
end
run_on_removals(paths) click to toggle source
# File lib/guard/minitest/runner.rb, line 70
def run_on_removals(paths)
  inspector.clear_memoized_test_files
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.