Class: Polyrun::Quick::Reporter
- Inherits:
-
Object
- Object
- Polyrun::Quick::Reporter
- Defined in:
- lib/polyrun/quick/reporter.rb
Instance Method Summary collapse
- #error(group, description, exc) ⇒ Object
- #fail(group, description, exc) ⇒ Object
-
#initialize(out, err, verbose) ⇒ Reporter
constructor
A new instance of Reporter.
- #pass(group, description) ⇒ Object
- #summary ⇒ Object
Constructor Details
#initialize(out, err, verbose) ⇒ Reporter
Returns a new instance of Reporter.
4 5 6 7 8 9 10 11 |
# File 'lib/polyrun/quick/reporter.rb', line 4 def initialize(out, err, verbose) @out = out @err = err @verbose = verbose @passed = 0 @failed = 0 @errors = 0 end |
Instance Method Details
#error(group, description, exc) ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/polyrun/quick/reporter.rb', line 26 def error(group, description, exc) @errors += 1 @err.puts " ERROR #{group} #{description}" @err.puts " #{exc.class}: #{exc.}" loc = exc.backtrace&.first @err.puts " #{loc}" if loc end |
#fail(group, description, exc) ⇒ Object
20 21 22 23 24 |
# File 'lib/polyrun/quick/reporter.rb', line 20 def fail(group, description, exc) @failed += 1 @err.puts " FAIL #{group} #{description}" @err.puts " #{exc.}" end |
#pass(group, description) ⇒ Object
13 14 15 16 17 18 |
# File 'lib/polyrun/quick/reporter.rb', line 13 def pass(group, description) @passed += 1 return unless @verbose @out.puts " ok #{group} #{description}" end |
#summary ⇒ Object
34 35 36 37 38 39 |
# File 'lib/polyrun/quick/reporter.rb', line 34 def summary total = @passed + @failed + @errors @out.puts @out.puts "Polyrun::Quick: #{@passed} passed, #{@failed} failed, #{@errors} errors (#{total} examples)" (@failed + @errors).positive? ? 1 : 0 end |