Sha256: b0b5ac9ca15b29f8aada876b2e3e025d7f098607ab14f302157b11948a728fb8

Contents?: true

Size: 1.6 KB

Versions: 4

Compression:

Stored size: 1.6 KB

Contents

describe "Mocha Teabag.Reporters.HTML", ->

  beforeEach ->
    @runner = {on: @onSpy = sinon.spy()}
    @superSpy = Teabag.Reporters.HTML.__super__.constructor = sinon.spy()
    Teabag.Reporters.HTML.filter = "foo"
    @reportRunnerStartingSpy = Teabag.Reporters.HTML.prototype.reportRunnerStarting = sinon.spy()
    @reporter = new Teabag.Reporters.HTML(@runner)

  describe "constructor", ->

    it "calls reporterRunnerStarting", ->
      assert.calledOnce(@reportRunnerStartingSpy, "foo")

    it "registers for 'fail', 'test end', and 'end'", ->
      assert.calledWith(@onSpy, "fail", @reporter.reportSpecResults)
      assert.calledWith(@onSpy, "test end", @reporter.reportSpecResults)
      assert.calledWith(@onSpy, "end", @reporter.reportRunnerResults)


  describe "#reportSpecResults", ->

    it "sets the error if one is passed in", ->
      spec = {}
      @reporter.reportSpecResults(spec, foo: "bar")
      expect(spec.err).to.eql(foo: "bar")


  describe "#envInfo", ->

    it "returns the version", ->
      expect(@reporter.envInfo()).to.be("mocha 1.7.4")


describe "Mocha Teabag.Reporters.HTML.SpecView", ->

  describe "#updateState", ->

    it "calls super with the duration of the spec", ->
      # this can't be tested, I tried a lot....
      #@superSpy = Teabag.Reporters.HTML.SpecView.__super__.updateState = sinon.spy()
      #@buildSpy = Teabag.Reporters.HTML.SpecView.prototype.build = sinon.spy()
      #view = new Teabag.Reporters.HTML.SpecView({viewId: 1000000}, {views: []})
      #view.spec.duration = 1000
      #view.updateState("passed")
      #assert.calledWith(@superSpy, "passed", 1000)

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
teabag-0.5.5 spec/javascripts/teabag/mocha/reporters/html_mspec.coffee
teabag-0.5.4 spec/javascripts/teabag/mocha/reporters/html_mspec.coffee
teabag-0.5.3 spec/javascripts/teabag/mocha/reporters/html_mspec.coffee
teabag-0.5.2 spec/javascripts/teabag/mocha/reporters/html_mspec.coffee