Class: Guard::MochaNode
- Inherits:
-
Guard
- Object
- Guard
- Guard::MochaNode
show all
- Defined in:
- lib/guard/mocha_node.rb,
lib/guard/mocha_node/runner.rb,
lib/guard/mocha_node/spec_state.rb
Defined Under Namespace
Modules: Runner
Classes: SpecState
Constant Summary
collapse
- DEFAULT_OPTIONS =
{
:mocha_bin => "mocha",
:all_after_pass => true,
:all_on_start => true,
:keep_failed => true,
:notify => true,
:coffeescript => true,
:livescript => false,
:verbose => true,
:reporter => "spec",
:color => true,
:recursive => true,
:require => nil,
:paths_for_all_specs => %w(spec),
:globals => []
}
Instance Method Summary
collapse
Constructor Details
#initialize(watchers = [], options = {}) ⇒ MochaNode
Returns a new instance of MochaNode.
26
27
28
29
|
# File 'lib/guard/mocha_node.rb', line 26
def initialize(watchers = [], options = {})
super(watchers, DEFAULT_OPTIONS.merge(options))
@state = SpecState.new
end
|
Instance Method Details
#failing_paths ⇒ Object
53
54
55
|
# File 'lib/guard/mocha_node.rb', line 53
def failing_paths
@state.failing_paths
end
|
#fixed? ⇒ Boolean
61
62
63
|
# File 'lib/guard/mocha_node.rb', line 61
def fixed?
@state.fixed?
end
|
#passing? ⇒ Boolean
57
58
59
|
# File 'lib/guard/mocha_node.rb', line 57
def passing?
@state.passing?
end
|
#run_all ⇒ Object
35
36
37
38
|
# File 'lib/guard/mocha_node.rb', line 35
def run_all
run( options[:paths_for_all_specs])
notify(:all)
end
|
#run_on_change(changed_paths = []) ⇒ Object
40
41
42
43
44
45
46
47
48
49
50
51
|
# File 'lib/guard/mocha_node.rb', line 40
def run_on_change(changed_paths = [])
run_paths = if options[:keep_failed]
failing_paths + changed_paths
else
changed_paths
end
run(run_paths)
notify(:some)
run_all if passing? and options[:all_after_pass]
end
|
#start ⇒ Object
31
32
33
|
# File 'lib/guard/mocha_node.rb', line 31
def start
run_all if options[:all_on_start]
end
|