Sha256: a076f16747fc8ccd9bad54d51d7263cee5a991abb1afe7de7e24b3fb4786e11e

Contents?: true

Size: 1.22 KB

Versions: 1

Compression:

Stored size: 1.22 KB

Contents

class Teaspoon.Qunit.Spec

  constructor: (@spec) ->
    @fullDescription = "#{@spec.module} #{@spec.name}"
    @description = "#{@spec.name} (#{@spec.failed}, #{@spec.passed}, #{@spec.total})"
    @link = "?grep=#{encodeURIComponent("#{@spec.module}: #{@spec.name}")}"
    @parent = if @spec.module then new Teaspoon.Qunit.Suite({description: @spec.module}) else null
    @suiteName = @spec.module
    @viewId = @spec.viewId
    @pending = false


  errors: ->
    return [] unless @spec.failed
    for item in @spec.assertions
      continue if item.result
      @provideFallbackMessage(item)
      {message: item.message, stack: item.source}


  getParents: ->
    return [] unless @parent
    [@parent]


  result: ->
    status = "failed"
    status = "passed" if @spec.failed == 0
    status: status
    skipped: false


  provideFallbackMessage: (item) ->
    return if item.message

    if item.actual && item.expected
      item.message ||= "Expected #{JSON.stringify(item.actual)} to equal #{JSON.stringify(item.expected)}"
    else
      item.message = 'failed'


# Shim since core still initializes this class, but the argument
# is the real spec object passed in from the responder.
class Teaspoon.Spec
  constructor: (spec) -> return spec

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
teaspoon-qunit-1.18.0 lib/teaspoon/qunit/assets/teaspoon/qunit/spec.coffee