Class: Spec::Runner::Formatter::SpecdocFormatter

Inherits:
BaseTextFormatter show all
Defined in:
lib/gems/rspec-1.1.12/lib/spec/runner/formatter/specdoc_formatter.rb

Instance Attribute Summary

Attributes inherited from BaseTextFormatter

#output, #pending_examples

Attributes inherited from BaseFormatter

#example_group, #options, #where

Instance Method Summary collapse

Methods inherited from BaseTextFormatter

#close, #colourise, #dump_failure, #dump_pending, #dump_summary, #format_backtrace, #initialize

Methods inherited from BaseFormatter

#close, #dump_failure, #dump_pending, #dump_summary, #example_started, #initialize, #start, #start_dump

Constructor Details

This class inherits a constructor from Spec::Runner::Formatter::BaseTextFormatter

Instance Method Details

#add_example_group(example_group) ⇒ Object



7
8
9
10
11
12
# File 'lib/gems/rspec-1.1.12/lib/spec/runner/formatter/specdoc_formatter.rb', line 7

def add_example_group(example_group)
  super
  output.puts
  output.puts example_group.description
  output.flush
end

#example_failed(example, counter, failure) ⇒ Object



14
15
16
17
18
19
20
21
22
23
# File 'lib/gems/rspec-1.1.12/lib/spec/runner/formatter/specdoc_formatter.rb', line 14

def example_failed(example, counter, failure)
  message = if failure.expectation_not_met?
    "- #{example.description} (FAILED - #{counter})"
  else
    "- #{example.description} (ERROR - #{counter})"
  end
  
  output.puts(failure.expectation_not_met? ? red(message) : magenta(message))
  output.flush
end

#example_passed(example) ⇒ Object



25
26
27
28
29
# File 'lib/gems/rspec-1.1.12/lib/spec/runner/formatter/specdoc_formatter.rb', line 25

def example_passed(example)
  message = "- #{example.description}"
  output.puts green(message)
  output.flush
end

#example_pending(example, message, pending_caller) ⇒ Object



31
32
33
34
35
# File 'lib/gems/rspec-1.1.12/lib/spec/runner/formatter/specdoc_formatter.rb', line 31

def example_pending(example, message, pending_caller)
  super
  output.puts yellow("- #{example.description} (PENDING: #{message})")
  output.flush
end