Class: Spec::Runner::Reporter
Defined Under Namespace
Classes: Failure
Instance Method Summary collapse
- #add_context(name) ⇒ Object
-
#dump ⇒ Object
Dumps the summary and returns the total number of failures.
- #end ⇒ Object
-
#initialize(formatter, backtrace_tweaker) ⇒ Reporter
constructor
A new instance of Reporter.
- #spec_finished(name, error = nil, failure_location = nil) ⇒ Object
- #spec_started(name) ⇒ Object
- #start(number_of_specs) ⇒ Object
Constructor Details
#initialize(formatter, backtrace_tweaker) ⇒ Reporter
Returns a new instance of Reporter.
5 6 7 8 9 |
# File 'lib/spec/runner/reporter.rb', line 5 def initialize(formatter, backtrace_tweaker) @formatter = formatter @backtrace_tweaker = backtrace_tweaker clear! end |
Instance Method Details
#add_context(name) ⇒ Object
11 12 13 14 15 |
# File 'lib/spec/runner/reporter.rb', line 11 def add_context(name) #TODO - @context_names.empty? tells the formatter whether this is the first context or not - that's a little slippery @formatter.add_context(name, @context_names.empty?) @context_names << name end |
#dump ⇒ Object
Dumps the summary and returns the total number of failures
42 43 44 45 46 47 |
# File 'lib/spec/runner/reporter.rb', line 42 def dump @formatter.start_dump dump_failures @formatter.dump_summary(duration, @spec_names.length, @failures.length) @failures.length end |
#end ⇒ Object
37 38 39 |
# File 'lib/spec/runner/reporter.rb', line 37 def end @end_time = Time.new end |
#spec_finished(name, error = nil, failure_location = nil) ⇒ Object
22 23 24 25 26 27 28 29 |
# File 'lib/spec/runner/reporter.rb', line 22 def spec_finished(name, error=nil, failure_location=nil) if error.nil? spec_passed(name) else @backtrace_tweaker.tweak_backtrace(error, failure_location) spec_failed(name, Failure.new(@context_names.last, name, error)) end end |
#spec_started(name) ⇒ Object
17 18 19 20 |
# File 'lib/spec/runner/reporter.rb', line 17 def spec_started(name) @spec_names << name @formatter.spec_started(name) end |
#start(number_of_specs) ⇒ Object
31 32 33 34 35 |
# File 'lib/spec/runner/reporter.rb', line 31 def start(number_of_specs) clear! @start_time = Time.new @formatter.start(number_of_specs) end |