Class: Spec::Runner::Reporter
- Defined in:
- lib/gems/rspec-1.1.12/lib/spec/runner/reporter.rb
Defined Under Namespace
Classes: Failure
Instance Attribute Summary collapse
-
#example_groups ⇒ Object
readonly
Returns the value of attribute example_groups.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #add_example_group(example_group) ⇒ Object
-
#dump ⇒ Object
Dumps the summary and returns the total number of failures.
- #end ⇒ Object
- #example_finished(example, error = nil) ⇒ Object
- #example_started(example) ⇒ Object
- #failure(example, error) ⇒ Object (also: #example_failed)
-
#initialize(options) ⇒ Reporter
constructor
A new instance of Reporter.
- #start(number_of_examples) ⇒ Object
Constructor Details
#initialize(options) ⇒ Reporter
Returns a new instance of Reporter.
6 7 8 9 10 |
# File 'lib/gems/rspec-1.1.12/lib/spec/runner/reporter.rb', line 6 def initialize() @options = @options.reporter = self clear end |
Instance Attribute Details
#example_groups ⇒ Object (readonly)
Returns the value of attribute example_groups.
4 5 6 |
# File 'lib/gems/rspec-1.1.12/lib/spec/runner/reporter.rb', line 4 def example_groups @example_groups end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
4 5 6 |
# File 'lib/gems/rspec-1.1.12/lib/spec/runner/reporter.rb', line 4 def @options end |
Instance Method Details
#add_example_group(example_group) ⇒ Object
12 13 14 15 16 17 |
# File 'lib/gems/rspec-1.1.12/lib/spec/runner/reporter.rb', line 12 def add_example_group(example_group) formatters.each do |f| f.add_example_group(example_group) end example_groups << example_group end |
#dump ⇒ Object
Dumps the summary and returns the total number of failures
56 57 58 59 60 61 62 63 64 65 |
# File 'lib/gems/rspec-1.1.12/lib/spec/runner/reporter.rb', line 56 def dump formatters.each{|f| f.start_dump} dump_pending dump_failures formatters.each do |f| f.dump_summary(duration, @examples.length, @failures.length, @pending_count) f.close end @failures.length end |
#end ⇒ Object
51 52 53 |
# File 'lib/gems/rspec-1.1.12/lib/spec/runner/reporter.rb', line 51 def end @end_time = Time.new end |
#example_finished(example, error = nil) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/gems/rspec-1.1.12/lib/spec/runner/reporter.rb', line 23 def example_finished(example, error=nil) @examples << example if error.nil? example_passed(example) elsif Spec::Example::ExamplePendingError === error example_pending(example, error.pending_caller, error.) else example_failed(example, error) end end |
#example_started(example) ⇒ Object
19 20 21 |
# File 'lib/gems/rspec-1.1.12/lib/spec/runner/reporter.rb', line 19 def example_started(example) formatters.each{|f| f.example_started(example)} end |
#failure(example, error) ⇒ Object Also known as: example_failed
35 36 37 38 39 40 41 42 |
# File 'lib/gems/rspec-1.1.12/lib/spec/runner/reporter.rb', line 35 def failure(example, error) backtrace_tweaker.tweak_backtrace(error) failure = Failure.new(example, error) @failures << failure formatters.each do |f| f.example_failed(example, @failures.length, failure) end end |