require 'rspec/core/formatters/base_text_formatter'

module RSpec
  module Core
    module Formatters
      class AugmentedTextFormatter < BaseTextFormatter
        def initialize(output)
          super(output)
        end

        def self.configure buffet_server, slave_name
          @@buffet_server = buffet_server
          @@slave_name = slave_name
        end

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

        def example_failed example
          super
          exception = example.metadata[:execution_result][:exception]
          backtrace = format_backtrace(exception.backtrace, example).join("\n")

          @@buffet_server.example_failed(@@slave_name, {
            :description => example.description,
            :backtrace   => backtrace,
            :message     => exception.message,
            :location    => example.location,
            :slave_name  => @@slave_name,
          })
        end

        def example_pending example, message, deprecated_pending_location=nil
          super
          @@buffet_server.example_pending(@@slave_name, {
            :description => example.description,
            :location    => example.location,
            :message     => message,
            :slave_name  => @@slave_name,
          })
        end
      end
    end
  end
end

require 'rspec/core/formatters/base_text_formatter'

module RSpec
  module Core
    module Formatters
      class AugmentedTextFormatter < BaseTextFormatter
        def initialize(output)
          super(output)
        end

        def self.configure buffet_server, slave_name
          @@buffet_server = buffet_server
          @@slave_name = slave_name
        end

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

        def example_failed example
          super
          exception = example.metadata[:execution_result][:exception]
          backtrace = format_backtrace(exception.backtrace, example).join("\n")

          @@buffet_server.example_failed(@@slave_name, {
            :description => example.description,
            :backtrace   => backtrace,
            :message     => exception.message,
            :location    => example.location,
            :slave_name  => @@slave_name,
          })
        end

        def example_pending example
          super
          @@buffet_server.example_pending(@@slave_name, {
            :description => example.description,
            :location    => example.location,
            :slave_name  => @@slave_name,
          })
        end
      end
    end
  end
end

Fix pending specs under rspec2 runner
Fix pending specs under rspec2 runner

The method signature for example_pending has changed between rspec1 and
rspec2. The rspec2 formatter wasn't aware of this change, causing specs
marked as pending to appear to be failing.

Change-Id: Ib591e46b14d86a4fa8a5bd35dbc766675df2ae09
Reviewed-on: https://gerrit.causes.com/4927
Reviewed-by: Noah Silas <1db01d43e08596f43a65fb393d969b98ee5b4dc6@causes.com>
Tested-by: Noah Silas <1db01d43e08596f43a65fb393d969b98ee5b4dc6@causes.com>
