Class: Tally
- Defined in:
- lib/extensions/mspec/mspec/runner/actions/tally.rb
Instance Attribute Summary collapse
-
#errors ⇒ Object
Returns the value of attribute errors.
-
#examples ⇒ Object
Returns the value of attribute examples.
-
#expectations ⇒ Object
Returns the value of attribute expectations.
-
#failures ⇒ Object
Returns the value of attribute failures.
-
#files ⇒ Object
Returns the value of attribute files.
-
#guards ⇒ Object
Returns the value of attribute guards.
Instance Method Summary collapse
- #error ⇒ Object
- #errors!(add = 1) ⇒ Object
- #example ⇒ Object
- #examples!(add = 1) ⇒ Object
- #expectation ⇒ Object
- #expectations!(add = 1) ⇒ Object
- #failure ⇒ Object
- #failures!(add = 1) ⇒ Object
- #file ⇒ Object
- #files!(add = 1) ⇒ Object
- #format ⇒ Object (also: #to_s)
- #guard ⇒ Object
- #guards!(add = 1) ⇒ Object
-
#initialize ⇒ Tally
constructor
A new instance of Tally.
Constructor Details
#initialize ⇒ Tally
Returns a new instance of Tally.
4 5 6 |
# File 'lib/extensions/mspec/mspec/runner/actions/tally.rb', line 4 def initialize @files = @examples = @expectations = @failures = @errors = @guards = 0 end |
Instance Attribute Details
#errors ⇒ Object
Returns the value of attribute errors.
2 3 4 |
# File 'lib/extensions/mspec/mspec/runner/actions/tally.rb', line 2 def errors @errors end |
#examples ⇒ Object
Returns the value of attribute examples.
2 3 4 |
# File 'lib/extensions/mspec/mspec/runner/actions/tally.rb', line 2 def examples @examples end |
#expectations ⇒ Object
Returns the value of attribute expectations.
2 3 4 |
# File 'lib/extensions/mspec/mspec/runner/actions/tally.rb', line 2 def expectations @expectations end |
#failures ⇒ Object
Returns the value of attribute failures.
2 3 4 |
# File 'lib/extensions/mspec/mspec/runner/actions/tally.rb', line 2 def failures @failures end |
#files ⇒ Object
Returns the value of attribute files.
2 3 4 |
# File 'lib/extensions/mspec/mspec/runner/actions/tally.rb', line 2 def files @files end |
#guards ⇒ Object
Returns the value of attribute guards.
2 3 4 |
# File 'lib/extensions/mspec/mspec/runner/actions/tally.rb', line 2 def guards @guards end |
Instance Method Details
#error ⇒ Object
48 49 50 |
# File 'lib/extensions/mspec/mspec/runner/actions/tally.rb', line 48 def error pluralize errors, "error" end |
#errors!(add = 1) ⇒ Object
24 25 26 |
# File 'lib/extensions/mspec/mspec/runner/actions/tally.rb', line 24 def errors!(add=1) @errors += add end |
#example ⇒ Object
36 37 38 |
# File 'lib/extensions/mspec/mspec/runner/actions/tally.rb', line 36 def example pluralize examples, "example" end |
#examples!(add = 1) ⇒ Object
12 13 14 |
# File 'lib/extensions/mspec/mspec/runner/actions/tally.rb', line 12 def examples!(add=1) @examples += add end |
#expectation ⇒ Object
40 41 42 |
# File 'lib/extensions/mspec/mspec/runner/actions/tally.rb', line 40 def expectation pluralize expectations, "expectation" end |
#expectations!(add = 1) ⇒ Object
16 17 18 |
# File 'lib/extensions/mspec/mspec/runner/actions/tally.rb', line 16 def expectations!(add=1) @expectations += add end |
#failure ⇒ Object
44 45 46 |
# File 'lib/extensions/mspec/mspec/runner/actions/tally.rb', line 44 def failure pluralize failures, "failure" end |
#failures!(add = 1) ⇒ Object
20 21 22 |
# File 'lib/extensions/mspec/mspec/runner/actions/tally.rb', line 20 def failures!(add=1) @failures += add end |
#file ⇒ Object
32 33 34 |
# File 'lib/extensions/mspec/mspec/runner/actions/tally.rb', line 32 def file pluralize files, "file" end |
#files!(add = 1) ⇒ Object
8 9 10 |
# File 'lib/extensions/mspec/mspec/runner/actions/tally.rb', line 8 def files!(add=1) @files += add end |
#format ⇒ Object Also known as: to_s
56 57 58 59 60 |
# File 'lib/extensions/mspec/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 |
#guard ⇒ Object
52 53 54 |
# File 'lib/extensions/mspec/mspec/runner/actions/tally.rb', line 52 def guard pluralize guards, "guard" end |
#guards!(add = 1) ⇒ Object
28 29 30 |
# File 'lib/extensions/mspec/mspec/runner/actions/tally.rb', line 28 def guards!(add=1) @guards += add end |