Sha256: 2fa46b84383ab06267df9afc2310164cb4483f54b0ed4352c6e8d415f15eb9aa

Contents?: true

Size: 1.54 KB

Versions: 6

Compression:

Stored size: 1.54 KB

Contents

#= require qunit-1.10.0
#= require teabag/base/teabag
#= require teabag/qunit/reporters/console
#= require teabag/qunit/reporters/html

class Teabag.Runner extends Teabag.Runner

  constructor: ->
    super
    env.start()


  setup: ->
    reporter = new (@getReporter())(env)
    reporter.setFilter?(@params["grep"])



class Teabag.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 Teabag.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 Teabag.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 = Teabag.Runner.prototype.getParams()["grep"]

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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
teabag-0.5.1 app/assets/javascripts/teabag/qunit.coffee
teabag-0.5.0 app/assets/javascripts/teabag/qunit.coffee
teabag-0.4.6 app/assets/javascripts/teabag/qunit.coffee
teabag-0.4.5 app/assets/javascripts/teabag/qunit.coffee
teabag-0.4.4 app/assets/javascripts/teabag/qunit.coffee
teabag-0.4.3 app/assets/javascripts/teabag/qunit.coffee