Class: Tavola::QED::Reporter
- Inherits:
-
QED::Reporter::Abstract
- Object
- QED::Reporter::Abstract
- Tavola::QED::Reporter
- Defined in:
- lib/tavola/qed/reporter.rb
Instance Method Summary collapse
- #after_session(session) ⇒ Object
- #applique(step) ⇒ Object
- #before_session(session) ⇒ Object
- #error(step, error) ⇒ Object
- #fail(step, error) ⇒ Object
- #match(step, md) ⇒ Object
- #pass(step) ⇒ Object
- #step(step) ⇒ Object
Instance Method Details
#after_session(session) ⇒ Object
88 89 90 91 92 |
# File 'lib/tavola/qed/reporter.rb', line 88 def after_session(session) trap 'INFO', 'DEFAULT' if INFO_SIGNAL print_time print_tally end |
#applique(step) ⇒ Object
25 26 27 28 |
# File 'lib/tavola/qed/reporter.rb', line 25 def applique(step) io.print "#{@_explain}" io.print "#{step.example}" # end |
#before_session(session) ⇒ Object
9 10 11 |
# File 'lib/tavola/qed/reporter.rb', line 9 def before_session(session) @start_time = Time.now end |
#error(step, error) ⇒ Object
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/tavola/qed/reporter.rb', line 65 def error(step, error) super(step, error) raise error if $DEBUG # TODO: Should this be here? tab = step.text.index(/\S/) print_step_heading(step) if step.has_example? wrap_example('red') do print_step_example(step) end end msg = [] msg << "ERROR: #{error.class} " + error. #.sub(/for QED::Context.*?$/,'') msg << sane_backtrace(error).join("\n") msg = msg.join("\n") # wrap_failure(msg) end |
#fail(step, error) ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/tavola/qed/reporter.rb', line 43 def fail(step, error) super(step, error) tab = step.text.index(/\S/) print_step_heading(step) if step.has_example? wrap_example('red') do print_step_example(step) end end msg = [] msg << "FAIL: " + error..to_s #to_str msg << sane_backtrace(error).join("\n") msg = msg.join("\n") wrap_failure(msg) end |
#match(step, md) ⇒ Object
18 19 20 21 22 |
# File 'lib/tavola/qed/reporter.rb', line 18 def match(step, md) unless md[0].empty? @_explain.sub!(md[0], md[0]) end end |
#pass(step) ⇒ Object
31 32 33 34 35 36 37 38 39 40 |
# File 'lib/tavola/qed/reporter.rb', line 31 def pass(step) super(step) print_step_heading(step) if step.has_example? wrap_example 'green' do print_step_example(step) end end end |
#step(step) ⇒ Object
13 14 15 |
# File 'lib/tavola/qed/reporter.rb', line 13 def step(step) @_explain = step.explain.dup end |