Sha256: 1e71c262b6708f28539bf0db33abb013646c4ffc4cea798254cbaf7ecab9e3e1

Contents?: true

Size: 882 Bytes

Versions: 6

Compression:

Stored size: 882 Bytes

Contents

describe "Lanes.Model.PubSub", ->
        
    it "checks in/out a model when it binds to a view", ->
        view  = new Lanes.Test.DummyView
        model = new Lanes.Test.DummyModel(id:1)
        spyOn(Lanes.Models.PubSub,'add').and.callThrough()
        spyOn(Lanes.Models.PubSub,'remove')
        view.model = model
        expect(Lanes.Models.PubSub.add).toHaveBeenCalledWith(model)
        expect(Lanes.Vendor.MessageBus.subscribe)
            .toHaveBeenCalledWith("/test/1", jasmine.any(Function))
        view.unset('model')
        expect(Lanes.Models.PubSub.remove).toHaveBeenCalledWith(model)

    it "can retrieve a model after checkin", ->
        model = new Lanes.Test.DummyModel(id: 11, name:'bar')
        Lanes.Models.PubSub.add(model)
        checkin = Lanes.Models.PubSub.instanceFor(Lanes.Test.DummyModel, 11)
        expect(checkin).toEqual(model)
        

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
lanes-0.1.9 spec/lanes/models/PubSubSpec.coffee
lanes-0.1.8 spec/lanes/models/PubSubSpec.coffee
lanes-0.1.7 spec/lanes/models/PubSubSpec.coffee
lanes-0.1.6 spec/lanes/models/PubSubSpec.coffee
lanes-0.1.5 spec/lanes/models/PubSubSpec.coffee
lanes-0.1.2 spec/lanes/models/PubSubSpec.coffee