Created
June 12, 2014 06:04
-
-
Save he9qi/a91f564fbfc4e45655ae to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#= require spec_helper | |
describe "Summon.PrivatePubEventsDispatcher", -> | |
describe "will trigger actions", -> | |
beforeEach -> | |
@controller = Ember.Object.create | |
queuer: {id: "1"} | |
trigger: -> | |
@dispatcher = Summon.PrivatePubEventsDispatcher.create | |
controller: @controller | |
describe "joined and not joined", -> | |
it "not joined", -> | |
mock = sinon.mock(@controller) | |
mock.expects("trigger").once().withArgs('invalid:popup', "Invalid room!") | |
@dispatcher.dispatch | |
event: "joined:captain:room" | |
released_queuers: [] | |
mock.verify() | |
it "joined", -> | |
mock = sinon.mock(@controller) | |
mock.expects("trigger").once().withArgs('captain:room:popup', "1") | |
privatePub = sinon.mock(PrivatePub) | |
privatePub.expects('unsubscribe').once().withArgs('/captain') | |
@dispatcher.dispatch | |
event: "joined:captain:room" | |
released_queuers: [{id: 1}] | |
room_id: "1" | |
mock.verify() | |
privatePub.verify() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment