Class: Guard::Minitest::Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/guard/minitest/runner.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Runner

Returns a new instance of Runner.



14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/guard/minitest/runner.rb', line 14

def initialize(options = {})
  parse_deprecated_options(options)

  @options = {
    :bundler  => File.exist?("#{Dir.pwd}/Gemfile"),
    :rubygems => false,
    :drb      => false,
    :test_folders       => %w[test spec],
    :test_file_patterns => %w[*_test.rb test_*.rb *_spec.rb],
    :cli      => ''
  }.merge(options)
  [:test_folders,:test_file_patterns].each {|k| (@options[k]= [@options[k]].flatten.uniq.compact).freeze}
  options= options.freeze
end

Class Method Details

.run(paths = [], options = {}) ⇒ Object



8
9
10
# File 'lib/guard/minitest/runner.rb', line 8

def run(paths = [], options = {})
  Runner.new(options).run(paths, options)
end

Instance Method Details

#bundler?Boolean

Returns:

  • (Boolean)


47
48
49
# File 'lib/guard/minitest/runner.rb', line 47

def bundler?
  @options[:bundler]
end

#cli_optionsObject



35
36
37
# File 'lib/guard/minitest/runner.rb', line 35

def cli_options
  @options[:cli] ||= ''
end

#drb?Boolean

Returns:

  • (Boolean)


55
56
57
# File 'lib/guard/minitest/runner.rb', line 55

def drb?
  @options[:drb]
end

#notify?Boolean

Returns:

  • (Boolean)


43
44
45
# File 'lib/guard/minitest/runner.rb', line 43

def notify?
  !!@options[:notification]
end

#rubygems?Boolean

Returns:

  • (Boolean)


51
52
53
# File 'lib/guard/minitest/runner.rb', line 51

def rubygems?
  !bundler? && @options[:rubygems]
end

#run(paths, options = {}) ⇒ Object



29
30
31
32
33
# File 'lib/guard/minitest/runner.rb', line 29

def run(paths, options = {})
  message = options[:message] || "Running: #{paths.join(' ')}"
  UI.info message, :reset => true
  system(minitest_command(paths))
end

#test_file_patternsObject



63
64
65
# File 'lib/guard/minitest/runner.rb', line 63

def test_file_patterns
  @options[:test_file_patterns]
end

#test_foldersObject



59
60
61
# File 'lib/guard/minitest/runner.rb', line 59

def test_folders
  @options[:test_folders]
end

#verbose?Boolean

Returns:

  • (Boolean)


39
40
41
# File 'lib/guard/minitest/runner.rb', line 39

def verbose?
  @options[:cli].include?('--verbose')
end