Class: RSpec::Core::Formatters::AugmentedTextFormatter

Inherits:
BaseTextFormatter
  • Object
show all
Defined in:
lib/buffet/rspec2_formatter.rb

Class Method Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (AugmentedTextFormatter) initialize(output)

A new instance of AugmentedTextFormatter



7
8
9
# File 'lib/buffet/rspec2_formatter.rb', line 7

def initialize(output)
  super(output)
end

Class Method Details

+ (Object) buffet_server=(buffet_server)



11
12
13
# File 'lib/buffet/rspec2_formatter.rb', line 11

def self.buffet_server=(buffet_server)
  @@buffet_server = buffet_server
end

Instance Method Details

- (Object) example_failed(example)



24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/buffet/rspec2_formatter.rb', line 24

def example_failed(example)
  super(example)
  exception = example.[:execution_result][:exception]
  message = exception.message 
  backtrace = format_backtrace(exception.backtrace, example).join("\n")
  description = example.description || "No description!"

  failure = {:header    => description,
             :backtrace => "No backtrace yet.", #TODO.
             :message   => message, 
             :location  => backtrace}

  @@buffet_server.example_failed(failure)
end

- (Object) example_passed(example)



19
20
21
22
# File 'lib/buffet/rspec2_formatter.rb', line 19

def example_passed(example)
  super
  @@buffet_server.example_passed({:description => example.description})
end

- (Object) example_pending(example, message, deprecated_pending_location = nil)



39
40
41
42
# File 'lib/buffet/rspec2_formatter.rb', line 39

def example_pending(example, message, deprecated_pending_location=nil)
  super
  @@buffet_server.example_pending(example_to_hash example)
end

- (Object) example_to_hash(example)



15
16
17
# File 'lib/buffet/rspec2_formatter.rb', line 15

def example_to_hash(example)
  example.description
end