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.



23
24
25
26
27
# File 'lib/guard/rspec/runner.rb', line 23

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.



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

def inspector
  @inspector
end

#notifierObject

Returns the value of attribute notifier.



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

def notifier
  @notifier
end

#optionsObject

Returns the value of attribute options.



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

def options
  @options
end

Instance Method Details

#reloadObject



48
49
50
# File 'lib/guard/rspec/runner.rb', line 48

def reload
  inspector.reload
end

#run(paths) ⇒ Object



37
38
39
40
41
42
43
44
45
46
# File 'lib/guard/rspec/runner.rb', line 37

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



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

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