Class: Peck::Counter

Inherits:
Object show all
Defined in:
lib/peck/counter.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeCounter

Returns a new instance of Counter.



15
16
17
18
19
20
21
# File 'lib/peck/counter.rb', line 15

def initialize
  @ran = @passed = @failed = 0
  @pending = []
  @missing = []
  @events  = []
  $stdout.sync = true
end

Instance Attribute Details

#eventsObject

Returns the value of attribute events.



13
14
15
# File 'lib/peck/counter.rb', line 13

def events
  @events
end

#failedObject

Returns the value of attribute failed.



13
14
15
# File 'lib/peck/counter.rb', line 13

def failed
  @failed
end

#missingObject

Returns the value of attribute missing.



13
14
15
# File 'lib/peck/counter.rb', line 13

def missing
  @missing
end

#passedObject

Returns the value of attribute passed.



13
14
15
# File 'lib/peck/counter.rb', line 13

def passed
  @passed
end

#pendingObject

Returns the value of attribute pending.



13
14
15
# File 'lib/peck/counter.rb', line 13

def pending
  @pending
end

#ranObject

Returns the value of attribute ran.



13
14
15
# File 'lib/peck/counter.rb', line 13

def ran
  @ran
end

Class Method Details

.instanceObject



9
10
11
# File 'lib/peck/counter.rb', line 9

def self.instance
  @instance ||= new
end

Instance Method Details

#finished_specification(spec) ⇒ Object



23
24
25
26
27
28
29
30
# File 'lib/peck/counter.rb', line 23

def finished_specification(spec)
  @ran += 1
  if spec.passed?
    @passed += 1
  elsif spec.failed?
    @failed += 1
  end
end

#received_exception(spec, exception) ⇒ Object



40
41
42
# File 'lib/peck/counter.rb', line 40

def received_exception(spec, exception)
  @events << exception
end

#received_missing(spec) ⇒ Object



36
37
38
# File 'lib/peck/counter.rb', line 36

def received_missing(spec)
  @missing << spec
end

#received_pending(label) ⇒ Object



32
33
34
# File 'lib/peck/counter.rb', line 32

def received_pending(label)
  @pending << label
end