Permalink
Browse files

Compatibility with Backbone 0.9.9

  • Loading branch information...
1 parent 0f7c149 commit 0f9f6740c47df10f5fe3aee99db3f5abb7b80ee7 @alekseykulikov committed Dec 14, 2012
@@ -61,7 +61,7 @@ describe 'Offline.Sync', ->
it 'should request data from server', ->
spyOn($, 'ajax')
@sync.full(@options)
- expect($.ajax).toHaveBeenCalledWith type: 'GET', dataType: 'json', url: '/api/dreams', success: jasmine.any(Function)
+ expect($.ajax.mostRecentCall.args[0].url).toEqual '/api/dreams'
it 'should store received data to localStorage', ->
@sync.full(@options)
@@ -131,7 +131,7 @@ describe 'Offline.Sync', ->
it 'should request data from server', ->
spyOn($, 'ajax')
@sync.pull()
- expect($.ajax).toHaveBeenCalledWith type: 'GET', dataType: 'json', url: '/api/dreams', success: jasmine.any(Function)
+ expect($.ajax.mostRecentCall.args[0].url).toEqual '/api/dreams'
it 'should destroy old items', ->
spyOn(@sync.collection, 'destroyDiff')
View
@@ -12,7 +12,7 @@
<!-- include vendor files here... -->
<script type="text/javascript" src="../vendor/jquery.js"></script>
<script type="text/javascript" src="../vendor/underscore.js"></script>
- <script type="text/javascript" src="../vendor/backbone.js"></script>
+ <script type="text/javascript" src="../vendor/backbone_099.js"></script>
<!-- include support files here... -->
<script type="text/javascript" src="support/jasmine_fake_ajax.js"></script>
@@ -6,7 +6,7 @@
do (global = window, _, Backbone) ->
global.Offline =
- VERSION: '0.4.0.alfa'
+ VERSION: '0.4.1.alfa'
# This is a method for CRUD operations with localStorage.
# Delegates to 'Offline.Storage' and works as ‘Backbone.sync’ alternative
@@ -18,7 +18,7 @@ do (global = window, _, Backbone) ->
when 'update' then store.update(model, options)
when 'delete' then store.destroy(model, options)
- if resp then options.success(resp) else options.error('Record not found')
+ if resp then options.success() else options.error?('Record not found')
# Overrides default 'Backbone.sync'. It checks 'storage' property of the model or collection
# and then delegates to 'Offline.localSync' when property exists else calls the default 'Backbone.sync' with received params.
@@ -150,7 +150,6 @@ do (global = window, _, Backbone) ->
@allIds.add(item.id)
@sync.pushItem(item) if @autoPush and !options.local
-
item
remove: (item, options = {}) ->
@@ -264,7 +263,7 @@ do (global = window, _, Backbone) ->
updateItem: (item, model) ->
if (new Date(model.get 'updated_at')) < (new Date(item.updated_at))
delete item.id
- model.save item, local: true
+ model.save(item, local: true)
# Use to send modifyed data to the server
# You can use it manually for sending changes
File renamed without changes.
Oops, something went wrong.

0 comments on commit 0f9f674

Please sign in to comment.