Class: Guard::JasmineNode

Inherits:
Guard
  • Object
show all
Defined in:
lib/guard/jasmine_node.rb,
lib/guard/jasmine_node/runner.rb,
lib/guard/jasmine_node/spec_state.rb

Defined Under Namespace

Modules: Runner Classes: SpecState

Constant Summary collapse

DEFAULT_OPTIONS =
{
  :jasmine_node_bin => "jasmine-node",
  :all_after_pass   => true,
  :all_on_start     => true,
  :keep_failed      => true,
  :notify           => true,
  :coffeescript     => true,
  :verbose          => false,
  :forceexit        => false,
  :spec_paths       => %w(spec)
}

Instance Method Summary collapse

Constructor Details

#initialize(watchers = [], options = {}) ⇒ JasmineNode

Returns a new instance of JasmineNode.



21
22
23
24
25
# File 'lib/guard/jasmine_node.rb', line 21

def initialize(watchers = [], options = {})
  options[:spec_paths] = options[:spec_paths].split(",") if options[:spec_paths].respond_to?(:split)
  super(watchers, DEFAULT_OPTIONS.merge(options))
  @state = SpecState.new
end

Instance Method Details

#failing_pathsObject



49
50
51
# File 'lib/guard/jasmine_node.rb', line 49

def failing_paths
 @state.failing_paths
end

#fixed?Boolean

Returns:

  • (Boolean)


57
58
59
# File 'lib/guard/jasmine_node.rb', line 57

def fixed?
  @state.fixed?
end

#passing?Boolean

Returns:

  • (Boolean)


53
54
55
# File 'lib/guard/jasmine_node.rb', line 53

def passing?
  @state.passing?
end

#run_allObject



31
32
33
34
# File 'lib/guard/jasmine_node.rb', line 31

def run_all
  run(options[:spec_paths])
  notify(:all)
end

#run_on_change(changed_paths = []) ⇒ Object



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

def run_on_change(changed_paths = [])
  run_paths = if options[:keep_failed]
                failing_paths + changed_paths
              else
                changed_paths
              end.uniq

  run(run_paths)
  notify(:some)

  run_all if passing? and options[:all_after_pass]
end

#startObject



27
28
29
# File 'lib/guard/jasmine_node.rb', line 27

def start
  run_all if options[:all_on_start]
end