Sha256: c71b53ac8e5a5e96dd4835dea4a8a8b42fc2628e49f49f59e851afa8548b7cbf

Contents?: true

Size: 1.83 KB

Versions: 6

Compression:

Stored size: 1.83 KB

Contents

#= require mocha-1.8.1
#= 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()
    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.7.1 app/assets/javascripts/teabag/mocha.coffee
teabag-0.7.0 app/assets/javascripts/teabag/mocha.coffee
teabag-0.6.0 app/assets/javascripts/teabag/mocha.coffee
teabag-0.5.5 app/assets/javascripts/teabag/mocha.coffee
teabag-0.5.4 app/assets/javascripts/teabag/mocha.coffee
teabag-0.5.3 app/assets/javascripts/teabag/mocha.coffee