Skip to content

Instantly share code, notes, and snippets.

@brian-mann
Last active December 25, 2015 05:09
Show Gist options
  • Select an option

  • Save brian-mann/6922710 to your computer and use it in GitHub Desktop.

Select an option

Save brian-mann/6922710 to your computer and use it in GitHub Desktop.
spying on ui hash
#= require support/spec_helper
class View extends App.Views.ItemView
template: "tooltips"
describe "Tooltip Concerns", ->
beforeEach ->
@view = new View
@view.onRender = =>
@tooltip = sinon.spy(@view.ui.tooltips, "tooltip")
App.mainRegion.show @view
afterEach ->
@view.ui.tooltips.tooltip?.restore?()
it "references tooltips in the ui", ->
expect(@view.ui.tooltips).to.exist
it "enables tooltips", ->
expect(@tooltip).to.have.been.called
it "disables tooltips when the view is closed", ->
App.mainRegion.close()
expect(@tooltip).to.have.been.calledWith("destroy")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment