Class: TallyAction
- Defined in:
- lib/extensions/mspec/mspec/runner/actions/tally.rb
Instance Attribute Summary collapse
-
#counter ⇒ Object
readonly
Returns the value of attribute counter.
Instance Method Summary collapse
-
#example(state, block) ⇒ Object
Callback for the MSpec :example event.
-
#exception(exception) ⇒ Object
Callback for the MSpec :exception event.
-
#expectation(state) ⇒ Object
Callback for the MSpec :expectation event.
- #format ⇒ Object
-
#initialize ⇒ TallyAction
constructor
A new instance of TallyAction.
- #load ⇒ Object
- #register ⇒ Object
- #unregister ⇒ Object
Constructor Details
#initialize ⇒ TallyAction
Returns a new instance of TallyAction.
73 74 75 |
# File 'lib/extensions/mspec/mspec/runner/actions/tally.rb', line 73 def initialize @counter = Tally.new end |
Instance Attribute Details
#counter ⇒ Object (readonly)
Returns the value of attribute counter.
71 72 73 |
# File 'lib/extensions/mspec/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/extensions/mspec/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/extensions/mspec/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/extensions/mspec/mspec/runner/actions/tally.rb', line 97 def expectation(state) @counter.expectations! end |
#format ⇒ Object
113 114 115 |
# File 'lib/extensions/mspec/mspec/runner/actions/tally.rb', line 113 def format @counter.format end |
#load ⇒ Object
91 92 93 |
# File 'lib/extensions/mspec/mspec/runner/actions/tally.rb', line 91 def load @counter.files! end |
#register ⇒ Object
77 78 79 80 81 82 |
# File 'lib/extensions/mspec/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 |
#unregister ⇒ Object
84 85 86 87 88 89 |
# File 'lib/extensions/mspec/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 |