Sha256: 5aca8fb93744891b4253f837d2b21db3a8f8fed5ed6ef37ca0cc96fc03a22ea1

Contents?: true

Size: 884 Bytes

Versions: 6

Compression:

Stored size: 884 Bytes

Contents

require 'teaspoon/formatters/base_formatter'

module Teaspoon
  module Formatters
    class TapFormatter < BaseFormatter

      def runner(result)
        log "1..#{result.total}"
      end

      def spec(result)
        super
        @result = result
        return passing_spec if result.passing?
        return pending_spec if result.pending?
        failing_spec
      end

      def error(error)
        @errors << error
      end

      def suppress_logs?
        true
      end

      private

      def passing_spec
        log "ok #{@total} - #{@result.description}"
      end

      def pending_spec
        log "ok #{@total} - [pending] #{@result.description}"
      end

      def failing_spec
        log "not ok #{@total} - #{@result.description}\n  # FAIL #{@result.message}"
      end

      def log(str)
        STDOUT.print("#{str}\n")
      end

    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
teaspoon-0.7.9 lib/teaspoon/formatters/tap_formatter.rb
teaspoon-0.7.8 lib/teaspoon/formatters/tap_formatter.rb
teaspoon-0.7.7 lib/teaspoon/formatters/tap_formatter.rb
teaspoon-0.7.6 lib/teaspoon/formatters/tap_formatter.rb
teaspoon-0.7.5 lib/teaspoon/formatters/tap_formatter.rb
teaspoon-0.7.4 lib/teaspoon/formatters/tap_formatter.rb