Sha256: 686fcc3f5f9587ee1aeb30f129cc98410e91c9b199eb26a22dea19fdc10d0c3d

Contents?: true

Size: 1.85 KB

Versions: 5

Compression:

Stored size: 1.85 KB

Contents

#= require mocha-1.10.0
#= require teaspoon/base/teaspoon
#= require teaspoon/mocha/reporters/console
#= require teaspoon/mocha/reporters/html

class Teaspoon.Runner extends Teaspoon.Runner

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


  setup: ->
    # add the reporter and set the filter
    reporter = @getReporter()
    env.setup(reporter: reporter)



class Teaspoon.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 Teaspoon.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 Teaspoon.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 Teaspoon.fixture extends Teaspoon.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

5 entries across 5 versions & 1 rubygems

Version Path
teaspoon-0.7.9 app/assets/javascripts/teaspoon/mocha.coffee
teaspoon-0.7.8 app/assets/javascripts/teaspoon/mocha.coffee
teaspoon-0.7.7 app/assets/javascripts/teaspoon/mocha.coffee
teaspoon-0.7.6 app/assets/javascripts/teaspoon/mocha.coffee
teaspoon-0.7.5 app/assets/javascripts/teaspoon/mocha.coffee