Sha256: 8090cea28c38d5ae05463bf3fc65791e145de6994de199b7dd70e3c5f6566053

Contents?: true

Size: 1.52 KB

Versions: 4

Compression:

Stored size: 1.52 KB

Contents

#= require qunit-1.11.0
#= require teaspoon/base/teaspoon
#= require teaspoon/qunit/reporters/console
#= require teaspoon/qunit/reporters/html

class Teaspoon.Runner extends Teaspoon.Runner

  constructor: ->
    super
    env.start()


  setup: ->
    new (@getReporter())(env)



class Teaspoon.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.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
      {message: item.message, stack: item.source}


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


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



class Teaspoon.Suite

  constructor: (@suite) ->
    @fullDescription = @suite.description
    @description = @suite.description
    @link = "?grep=#{encodeURIComponent(@fullDescription)}"
    @parent = null


# set the environment
env = QUnit
env.config.autostart = false
env.config.altertitle = false
env.config.filter = Teaspoon.Runner.prototype.getParams()["grep"]

window.fixture = Teaspoon.fixture
originalReset = env.reset
env.reset = ->
  originalReset()
  Teaspoon.fixture.cleanup()

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
teaspoon-0.7.7 app/assets/javascripts/teaspoon/qunit.coffee
teaspoon-0.7.6 app/assets/javascripts/teaspoon/qunit.coffee
teaspoon-0.7.5 app/assets/javascripts/teaspoon/qunit.coffee
teaspoon-0.7.4 app/assets/javascripts/teaspoon/qunit.coffee