Class: Guard::SporkMinitest::Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/guard/sporkminitest/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
# File 'lib/guard/sporkminitest/runner.rb', line 14

def initialize(options = {})
  @options = {
    :test_folders       => %w[test spec],
    :test_file_patterns => %w[*_test.rb test_*.rb *_spec.rb],
    :cli                => ''
  }.merge(options)

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

Class Method Details

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



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

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

Instance Method Details

#cli_optionsObject



32
33
34
# File 'lib/guard/sporkminitest/runner.rb', line 32

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

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



26
27
28
29
30
# File 'lib/guard/sporkminitest/runner.rb', line 26

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

#test_file_patternsObject



40
41
42
# File 'lib/guard/sporkminitest/runner.rb', line 40

def test_file_patterns
  @options[:test_file_patterns]
end

#test_foldersObject



36
37
38
# File 'lib/guard/sporkminitest/runner.rb', line 36

def test_folders
  @options[:test_folders]
end