Class: Guard::JasmineNode::SpecState

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

Constant Summary collapse

STDIN =
0
STDOUT =
1
STDERR =
2
THREAD =
3
SUCCESS_CODE =
0
ERROR_CODE =
1

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeSpecState

Returns a new instance of SpecState.



14
15
16
# File 'lib/guard/jasmine_node/spec_state.rb', line 14

def initialize
  clear!
end

Instance Attribute Details

#failing_pathsObject

Returns the value of attribute failing_paths.



12
13
14
# File 'lib/guard/jasmine_node/spec_state.rb', line 12

def failing_paths
  @failing_paths
end

Instance Method Details

#clear!Object



40
41
42
43
44
# File 'lib/guard/jasmine_node/spec_state.rb', line 40

def clear!
  @passed = true
  @fixed  = false
  @failing_paths = []
end

#fixed?Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/guard/jasmine_node/spec_state.rb', line 36

def fixed?
  @fixed
end

#passing?Boolean

Returns:

  • (Boolean)


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

def passing?
  @passed
end

#update(run_paths = [], options = {}) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/guard/jasmine_node/spec_state.rb', line 18

def update(run_paths = [], options = {})
  @run_paths = run_paths
  @io = Runner.run(@run_paths, options)
  @stdout     = @io[STDOUT]
  @stderr     = @io[STDERR]
  @exitstatus = @io[THREAD].value rescue ERROR_CODE
  @stderr.each_line { |line| print line }
  @stdout.each_line { |line| print line }
  close_io
  update_passed_and_fixed
  update_failing_paths
  passing?
end