Sha256: 45e71ed7f32d8a4780d18b5ab876c6e5c5d6586049126863cfd6322fef3dba95

Contents?: true

Size: 606 Bytes

Versions: 5

Compression:

Stored size: 606 Bytes

Contents

module Teabag

  RESULT_ATTRS = [
    :type,
    :suite,
    :label,
    :status,
    :skipped,
    :link,
    :message,
    :trace,
    :elapsed,
    :total,
    :start,
    :level,
    :coverage
  ]

  class Result < Struct.new(*RESULT_ATTRS)

    def self.build_from_json(json)
      new(*RESULT_ATTRS.map{ |attr| json[attr.to_s] })
    end

    def description
      "#{suite} #{label}"
    end

    def failing?
      (status != "passed" && status != "pending") && type == "spec"
    end

    def passing?
      status == "passed"
    end

    def pending?
      status == "pending"
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
teabag-0.7.3 lib/teabag/result.rb
teabag-0.7.2 lib/teabag/result.rb
teabag-0.7.1 lib/teabag/result.rb
teabag-0.7.0 lib/teabag/result.rb
teabag-0.6.0 lib/teabag/result.rb