Class: TallyAction

Inherits:
Object show all
Defined in:
lib/mspec/runner/actions/tally.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeTallyAction

Returns a new instance of TallyAction.



46
47
48
# File 'lib/mspec/runner/actions/tally.rb', line 46

def initialize
  @counter = Tally.new
end

Instance Attribute Details

#counterObject (readonly)

Returns the value of attribute counter.



44
45
46
# File 'lib/mspec/runner/actions/tally.rb', line 44

def counter
  @counter
end

Instance Method Details

#example(state, block) ⇒ Object

Callback for the MSpec :example event. Increments the tally of examples.



82
83
84
# File 'lib/mspec/runner/actions/tally.rb', line 82

def example(state, block)
  @counter.examples!
end

#exception(exception) ⇒ Object

Callback for the MSpec :exception event. Increments the tally of errors and failures.



76
77
78
# File 'lib/mspec/runner/actions/tally.rb', line 76

def exception(exception)
  exception.failure? ? @counter.failures! : @counter.errors!
end

#expectation(state) ⇒ Object

Callback for the MSpec :expectation event. Increments the tally of expectations (e.g. #should, #should_receive, etc.).



70
71
72
# File 'lib/mspec/runner/actions/tally.rb', line 70

def expectation(state)
  @counter.expectations!
end

#formatObject



86
87
88
# File 'lib/mspec/runner/actions/tally.rb', line 86

def format
  @counter.format
end

#loadObject



64
65
66
# File 'lib/mspec/runner/actions/tally.rb', line 64

def load
  @counter.files!
end

#registerObject



50
51
52
53
54
55
# File 'lib/mspec/runner/actions/tally.rb', line 50

def register
  MSpec.register :load,        self
  MSpec.register :exception,   self
  MSpec.register :example,     self
  MSpec.register :expectation, self
end

#unregisterObject



57
58
59
60
61
62
# File 'lib/mspec/runner/actions/tally.rb', line 57

def unregister
  MSpec.unregister :load,        self
  MSpec.unregister :exception,   self
  MSpec.unregister :example,     self
  MSpec.unregister :expectation, self
end