Sha256: b292abcd2a4955b65bc954bb7f058d851e5f66b4e0e3ee751244f751a5f70e1e

Contents?: true

Size: 1.94 KB

Versions: 4

Compression:

Stored size: 1.94 KB

Contents

require "yaml"
require "teaspoon/formatter/base"

module Teaspoon
  module Formatter
    class TapY < Base
      protected

        def log_runner(result)
          log "type" => "suite",
              "start" => result.start,
              "count" => result.total,
              "seed" => 0,
              "rev" => 4
        end

        def log_suite(result)
          log "type" => "case",
              "label" => result.label,
              "level" => result.level
        end

        def log_passing_spec(result)
          log "type" => "test",
              "status" => "pass",
              "label" => result.label,
              "stdout" => @stdout
        end

        def log_pending_spec(result)
          log "type" => "test",
              "status" => "pending",
              "label" => result.label,
              "stdout" => @stdout,
              "exception" => {
                "message" => result.message
              }
        end

        def log_failing_spec(result)
          log "type" => "test",
              "status" => "fail",
              "label" => result.label,
              "stdout" => @stdout,
              "exception" => {
                "message" => result.message,
                "backtrace" => ["#{result.link}#:0"],
                "file" => "unknown",
                "line" => "unknown",
                "source" => "unknown",
                "snippet" => { "0" => result.link },
                "class" => "Unknown"
              }
        end

        def log_result(result)
          log "type" => "final",
              "time" => result.elapsed,
              "counts" => {
                "total" => @run_count,
                "pass" => @passes.size,
                "fail" => @failures.size,
                "error" => @errors.size,
                "omit" => 0,
                "todo" => @pendings.size
              }
        end

      private

        def log(hash)
          log_str(hash.to_yaml)
        end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
teaspoon-1.4.0 lib/teaspoon/formatter/tap_y.rb
teaspoon-1.2.2 lib/teaspoon/formatter/tap_y.rb
teaspoon-1.2.1 lib/teaspoon/formatter/tap_y.rb
teaspoon-1.2.0 lib/teaspoon/formatter/tap_y.rb