Sha256: 843e2eefb3997ebc86185c66418492d66ee8dbc8b847526622a3112204b5f72a

Contents?: true

Size: 1.92 KB

Versions: 9

Compression:

Stored size: 1.92 KB

Contents

describe "Jasmine Teabag.Runner", ->

  beforeEach ->
    @env = jasmine.getEnv()
    @originalFilter = @env.specFilter
    @executeSpy = spyOn(@env, "execute")
    @runner = new Teabag.Runner()

  afterEach ->
    @env.specFilter = @originalFilter

  describe "constructor", ->

    it "calls execute on the jasmine env", ->
      expect(@executeSpy).toHaveBeenCalled()


  describe "#setup", ->

    beforeEach ->
      @runner.params = {grep: "foo"}
      if window.navigator.userAgent.match(/PhantomJS/)
        @reporterSpy = spyOn(Teabag.Reporters, "Console").andReturn(@instance)
      else
        @reporterSpy = spyOn(Teabag.Reporters, "HTML").andReturn(@instance)
      @addReporterSpy = spyOn(@env, "addReporter")

    it "sets the updateInterval", ->
      expect(@env.updateInterval).toEqual(1000)

    it "adds the reporter to the env", ->
      @runner.setup()
      expect(@reporterSpy).toHaveBeenCalled()
      expect(@addReporterSpy).toHaveBeenCalled()

    it "adds fixture support", ->
      spy = spyOn(@runner, "addFixtureSupport")
      @runner.setup()
      expect(spy).toHaveBeenCalled()


  describe "#addFixtureSupport", ->

    beforeEach ->
      @fixtureObj = {cleanUp: ->}
      @styleFixtureObj = {cleanUp: ->}
      @jsonFixtureSpyObj = {cleanUp: ->}
      @fixtureSpy = spyOn(jasmine, "getFixtures").andReturn(@fixtureObj)
      @styleFixtureSpy = spyOn(jasmine, "getStyleFixtures").andReturn(@styleFixtureObj)
      @jsonFixtureSpy = spyOn(jasmine, "getJSONFixtures").andReturn(@jsonFixtureSpyObj)

    it "adds fixture support", ->
      expect(jasmine.getFixtures).toBeDefined()
      @runner.fixturePath = "/path/to/fixtures"
      @runner.addFixtureSupport()
      expect(@fixtureObj.containerId).toBe("teabag-fixtures")
      expect(@fixtureObj.fixturesPath).toBe("/path/to/fixtures")
      expect(@styleFixtureObj.fixturesPath).toBe("/path/to/fixtures")
      expect(@jsonFixtureSpyObj.fixturesPath).toBe("/path/to/fixtures")

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
teabag-0.7.3 spec/javascripts/teabag/jasmine/runner_jspec.coffee
teabag-0.7.2 spec/javascripts/teabag/jasmine/runner_jspec.coffee
teabag-0.7.1 spec/javascripts/teabag/jasmine/runner_jspec.coffee
teabag-0.7.0 spec/javascripts/teabag/jasmine/runner_jspec.coffee
teabag-0.6.0 spec/javascripts/teabag/jasmine/runner_jspec.coffee
teabag-0.5.5 spec/javascripts/teabag/jasmine/runner_jspec.coffee
teabag-0.5.4 spec/javascripts/teabag/jasmine/runner_jspec.coffee
teabag-0.5.3 spec/javascripts/teabag/jasmine/runner_jspec.coffee
teabag-0.5.2 spec/javascripts/teabag/jasmine/runner_jspec.coffee