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.



73
74
75
# File 'lib/mspec/runner/actions/tally.rb', line 73

def initialize
  @counter = Tally.new
end

Instance Attribute Details

#counterObject (readonly)

Returns the value of attribute counter.



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

def counter
  @counter
end

Instance Method Details

#example(state, block) ⇒ Object

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



109
110
111
# File 'lib/mspec/runner/actions/tally.rb', line 109

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

#exception(exception) ⇒ Object

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



103
104
105
# File 'lib/mspec/runner/actions/tally.rb', line 103

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.).



97
98
99
# File 'lib/mspec/runner/actions/tally.rb', line 97

def expectation(state)
  @counter.expectations!
end

#formatObject



113
114
115
# File 'lib/mspec/runner/actions/tally.rb', line 113

def format
  @counter.format
end

#loadObject



91
92
93
# File 'lib/mspec/runner/actions/tally.rb', line 91

def load
  @counter.files!
end

#registerObject



77
78
79
80
81
82
# File 'lib/mspec/runner/actions/tally.rb', line 77

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

#unregisterObject



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

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