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.
46 47 48 |
# File 'lib/mspec/runner/actions/tally.rb', line 46 def initialize @counter = Tally.new end |
Instance Attribute Details
#counter ⇒ Object (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 |
#format ⇒ Object
86 87 88 |
# File 'lib/mspec/runner/actions/tally.rb', line 86 def format @counter.format end |
#load ⇒ Object
64 65 66 |
# File 'lib/mspec/runner/actions/tally.rb', line 64 def load @counter.files! end |
#register ⇒ Object
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 |
#unregister ⇒ Object
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 |