Class: Guard::RSpec::Runner

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

Defined Under Namespace

Classes: NoCmdOptionError

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Runner

Returns a new instance of Runner.



20
21
22
23
24
# File 'lib/guard/rspec/runner.rb', line 20

def initialize(options = {})
  @options = options
  @inspector = Inspectors::Factory.create(@options)
  @notifier = Notifier.new(@options)
end

Instance Attribute Details

#inspectorObject

Returns the value of attribute inspector.



18
19
20
# File 'lib/guard/rspec/runner.rb', line 18

def inspector
  @inspector
end

#notifierObject

Returns the value of attribute notifier.



18
19
20
# File 'lib/guard/rspec/runner.rb', line 18

def notifier
  @notifier
end

#optionsObject

Returns the value of attribute options.



18
19
20
# File 'lib/guard/rspec/runner.rb', line 18

def options
  @options
end

Instance Method Details

#reloadObject



45
46
47
# File 'lib/guard/rspec/runner.rb', line 45

def reload
  inspector.reload
end

#run(paths) ⇒ Object



34
35
36
37
38
39
40
41
42
43
# File 'lib/guard/rspec/runner.rb', line 34

def run(paths)
  paths = inspector.paths(paths)
  return true if paths.empty?
  Compat::UI.info("Running: #{paths.join(' ')}", reset: true)
  _run(paths, options) do |all_green|
    next false unless all_green
    next true unless options[:all_after_pass]
    run_all
  end
end

#run_allObject



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

def run_all
  paths = options[:spec_paths]
  options = @options.merge(@options[:run_all])
  return true if paths.empty?
  Compat::UI.info(options[:message], reset: true)
  _run(paths, options)
end