Class: TallyAction
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.
63 64 65 |
# File 'lib/mspec/runner/actions/tally.rb', line 63 def initialize @counter = Tally.new end |
Instance Attribute Details
#counter ⇒ Object (readonly)
Returns the value of attribute counter.
61 62 63 |
# File 'lib/mspec/runner/actions/tally.rb', line 61 def counter @counter end |
Instance Method Details
#example(state, block) ⇒ Object
Callback for the MSpec :example event. Increments the tally of examples.
99 100 101 |
# File 'lib/mspec/runner/actions/tally.rb', line 99 def example(state, block) @counter.examples! end |
#exception(exception) ⇒ Object
Callback for the MSpec :exception event. Increments the tally of errors and failures.
93 94 95 |
# File 'lib/mspec/runner/actions/tally.rb', line 93 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.).
87 88 89 |
# File 'lib/mspec/runner/actions/tally.rb', line 87 def expectation(state) @counter.expectations! end |
#format ⇒ Object
103 104 105 |
# File 'lib/mspec/runner/actions/tally.rb', line 103 def format @counter.format end |
#load ⇒ Object
81 82 83 |
# File 'lib/mspec/runner/actions/tally.rb', line 81 def load @counter.files! end |
#register ⇒ Object
67 68 69 70 71 72 |
# File 'lib/mspec/runner/actions/tally.rb', line 67 def register MSpec.register :load, self MSpec.register :exception, self MSpec.register :example, self MSpec.register :expectation, self end |
#unregister ⇒ Object
74 75 76 77 78 79 |
# File 'lib/mspec/runner/actions/tally.rb', line 74 def unregister MSpec.unregister :load, self MSpec.unregister :exception, self MSpec.unregister :example, self MSpec.unregister :expectation, self end |