Sha256: de54fdc1a224b908009d90d37b3358d9d10d5f700827c2dd99ab7ecc1d8a5498

Contents?: true

Size: 1.86 KB

Versions: 6

Compression:

Stored size: 1.86 KB

Contents

#= require mocha-1.7.4
#= require teabag/base/teabag
#= require teabag/mocha/reporters/console
#= require teabag/mocha/reporters/html

class Teabag.Runner extends Teabag.Runner

  constructor: ->
    super
    env.run()
    env.started = true
    afterEach -> Teabag.fixture.cleanup()


  setup: ->
    # add the reporter and set the filter
    reporter = @getReporter()
    reporter.filter = @params["grep"]
    env.setup(reporter: reporter)



class Teabag.Spec

  constructor: (@spec) ->
    @fullDescription = @spec.fullTitle()
    @description = @spec.title
    @link = "?grep=#{encodeURIComponent(@fullDescription)}"
    @parent = @spec.parent
    @suiteName = @parent.fullTitle()
    @viewId = @spec.viewId
    @pending = @spec.pending


  errors: ->
    return [] unless @spec.err
    [@spec.err]


  getParents: ->
    return @parents if @parents
    @parents ||= []
    parent = @parent
    while parent
      parent = new Teabag.Suite(parent)
      @parents.unshift(parent)
      parent = parent.parent
    @parents


  result: ->
    status = "failed"
    status = "passed" if @spec.state == "passed" || @spec.state == "skipped"
    status = "pending" if @spec.pending
    status: status
    skipped: @spec.state == "skipped"



class Teabag.Suite

  constructor: (@suite) ->
    @fullDescription = @suite.fullTitle()
    @description = @suite.title
    @link = "?grep=#{encodeURIComponent(@fullDescription)}"
    @parent = if @suite.parent.root then null else @suite.parent
    @viewId = @suite.viewId



class Teabag.fixture extends Teabag.fixture

  window.fixture = @

  @load: ->
    args = arguments
    if env.started then super
    else beforeEach => fixture.__super__.constructor.load.apply(@, args)


  @set: ->
    args = arguments
    if env.started then super
    else beforeEach => fixture.__super__.constructor.set.apply(@, args)



# set the environment
env = mocha.setup("bdd")

Version data entries

6 entries across 6 versions & 1 rubygems

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