Class: Tally

Inherits:
Object show all
Defined in:
lib/mspec/runner/actions/tally.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeTally

Returns a new instance of Tally.



4
5
6
# File 'lib/mspec/runner/actions/tally.rb', line 4

def initialize
  @files = @examples = @expectations = @failures = @errors = 0
end

Instance Attribute Details

#errorsObject

Returns the value of attribute errors.



2
3
4
# File 'lib/mspec/runner/actions/tally.rb', line 2

def errors
  @errors
end

#examplesObject

Returns the value of attribute examples.



2
3
4
# File 'lib/mspec/runner/actions/tally.rb', line 2

def examples
  @examples
end

#expectationsObject

Returns the value of attribute expectations.



2
3
4
# File 'lib/mspec/runner/actions/tally.rb', line 2

def expectations
  @expectations
end

#failuresObject

Returns the value of attribute failures.



2
3
4
# File 'lib/mspec/runner/actions/tally.rb', line 2

def failures
  @failures
end

#filesObject

Returns the value of attribute files.



2
3
4
# File 'lib/mspec/runner/actions/tally.rb', line 2

def files
  @files
end

Instance Method Details

#errors!(add = 1) ⇒ Object



24
25
26
# File 'lib/mspec/runner/actions/tally.rb', line 24

def errors!(add=1)
  @errors += add
end

#examples!(add = 1) ⇒ Object



12
13
14
# File 'lib/mspec/runner/actions/tally.rb', line 12

def examples!(add=1)
  @examples += add
end

#expectations!(add = 1) ⇒ Object



16
17
18
# File 'lib/mspec/runner/actions/tally.rb', line 16

def expectations!(add=1)
  @expectations += add
end

#failures!(add = 1) ⇒ Object



20
21
22
# File 'lib/mspec/runner/actions/tally.rb', line 20

def failures!(add=1)
  @failures += add
end

#files!(add = 1) ⇒ Object



8
9
10
# File 'lib/mspec/runner/actions/tally.rb', line 8

def files!(add=1)
  @files += add
end

#formatObject



28
29
30
31
32
33
34
35
# File 'lib/mspec/runner/actions/tally.rb', line 28

def format
  [ [@files, 'file'],
    [@examples, 'example'],
    [@expectations, 'expectation'],
    [@failures, 'failure'],
    [@errors, 'error']
  ].map { |count, word| pluralize count, word }.join(", ")
end