2
我有一個要求here無法填充骨幹收集與興農+茉莉
問題的作者提到,他能夠利用茉莉的單機版在無頭的WebKit來解決它同樣的問題。 在我的測試中,我只使用獨立版本的茉莉花,仍然有相同的問題。 這裏是我的代碼:
describe 'Shared Collections Specs', ->
describe 'Channel Collection', ->
describe 'When fetching channels', ->
responseFixture = null
channelCollection = null
server = null
beforeEach ->
channelCollection = new ChannelCollection()
responseFixture = [{id: 3, name: 'foo'}, {id: 1, name: 'bar'}, {id: 2, name: 'baz'}]
server = sinon.fakeServer.create()
server.respondWith('GET', 'enspoint/channels', [
200, {'Content-Type':'application/json'}, JSON.stringify responseFixture
])
afterEach ->
server.restore()
it 'should populate the collection', ->
channelCollection.fetch()
server.respond()
expect(channelCollection.length).toEqual responseFixture.length
集合總是空insted的預計長度的3失敗與Expected 0 to equal 3.
我試圖用茉莉waits
和runs
,我想可能有一些異步的過程,但我得到相同的結果。
任何想法?
你還可以發佈你的Backbone模型代碼嗎? – sffc