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.



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

def initialize
  @counter = Tally.new
end

Instance Attribute Details

#counterObject (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

#formatObject



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

def format
  @counter.format
end

#loadObject



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

def load
  @counter.files!
end

#registerObject



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

#unregisterObject



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