class Tally

Attributes

errors[RW]
examples[RW]
expectations[RW]
failures[RW]
files[RW]
guards[RW]

Public Class Methods

new() click to toggle source
# File lib/mspec/runner/actions/tally.rb, line 4
def initialize
  @files = @examples = @expectations = @failures = @errors = @guards = 0
end

Public Instance Methods

error() click to toggle source
# File lib/mspec/runner/actions/tally.rb, line 48
def error
  pluralize errors, "error"
end
errors!(add=1) click to toggle source
# File lib/mspec/runner/actions/tally.rb, line 24
def errors!(add=1)
  @errors += add
end
example() click to toggle source
# File lib/mspec/runner/actions/tally.rb, line 36
def example
  pluralize examples, "example"
end
examples!(add=1) click to toggle source
# File lib/mspec/runner/actions/tally.rb, line 12
def examples!(add=1)
  @examples += add
end
expectation() click to toggle source
# File lib/mspec/runner/actions/tally.rb, line 40
def expectation
  pluralize expectations, "expectation"
end
expectations!(add=1) click to toggle source
# File lib/mspec/runner/actions/tally.rb, line 16
def expectations!(add=1)
  @expectations += add
end
failure() click to toggle source
# File lib/mspec/runner/actions/tally.rb, line 44
def failure
  pluralize failures, "failure"
end
failures!(add=1) click to toggle source
# File lib/mspec/runner/actions/tally.rb, line 20
def failures!(add=1)
  @failures += add
end
file() click to toggle source
# File lib/mspec/runner/actions/tally.rb, line 32
def file
  pluralize files, "file"
end
files!(add=1) click to toggle source
# File lib/mspec/runner/actions/tally.rb, line 8
def files!(add=1)
  @files += add
end
format() click to toggle source
# File lib/mspec/runner/actions/tally.rb, line 56
def format
  results = [ file, example, expectation, failure, error ]
  results << guard if [:report, :report_on, :verify].any? { |m| MSpec.mode? m }
  results.join(", ")
end
Also aliased as: to_s
guard() click to toggle source
# File lib/mspec/runner/actions/tally.rb, line 52
def guard
  pluralize guards, "guard"
end
guards!(add=1) click to toggle source
# File lib/mspec/runner/actions/tally.rb, line 28
def guards!(add=1)
  @guards += add
end
to_s()
Alias for: format

Private Instance Methods

pluralize(count, singular) click to toggle source
# File lib/mspec/runner/actions/tally.rb, line 64
def pluralize(count, singular)
  "#{count} #{singular}#{'s' unless count == 1}"
end