Sha256: 22c1e82be37041cb8494b2772b786c75ab0c4225c1a8b18e4a34f5709a6839bb

Contents?: true

Size: 1.23 KB

Versions: 2

Compression:

Stored size: 1.23 KB

Contents

class Teaspoon.Qunit.Spec extends Teaspoon.Spec

  constructor: (@spec) ->
    @fullDescription = "#{@spec.module} #{@spec.name}"
    @description = "#{@spec.name} (#{@spec.failed}, #{@spec.passed}, #{@spec.total})"
    @link = @filterUrl("#{@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

2 entries across 2 versions & 1 rubygems

Version Path
teaspoon-qunit-1.20.0 lib/teaspoon/qunit/assets/teaspoon/qunit/spec.coffee
teaspoon-qunit-1.19.0 lib/teaspoon/qunit/assets/teaspoon/qunit/spec.coffee