Skip to content

Commit

Permalink
use read instead of get as sync method
Browse files Browse the repository at this point in the history
get is not a valid sync method in backbone
  • Loading branch information
Mathias Schreck committed Feb 7, 2014
1 parent 8c8d7ef commit f6a75f5
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions test/shared/syncer.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,21 +81,21 @@ describe('syncer', function() {
});

it('should call Backbone.sync', function () {
syncer.clientSync.call(model, 'get', model, options);
syncer.clientSync.call(model, 'read', model, options);

backboneSync.should.have.been.calledOnce;
backboneSync.should.have.been.calledWithExactly('get', model, options);
backboneSync.should.have.been.calledWithExactly('read', model, options);
});

it('should get the prefixed API url', function () {
syncer.clientSync.call(model, 'get', model, options);
backboneSync.should.have.been.calledWithExactly('get', model, { url: '/api/-' + model.url() });
syncer.clientSync.call(model, 'read', model, options);
backboneSync.should.have.been.calledWithExactly('read', model, { url: '/api/-' + model.url() });
});

it('should wrap the error handler', function () {
options.error = syncErrorHandler;

syncer.clientSync.call(model, 'get', model, options);
syncer.clientSync.call(model, 'read', model, options);

syncErrorHandler.should.be.not.equal(options.error);
options.error.should.be.a('function');
Expand All @@ -121,7 +121,7 @@ describe('syncer', function() {
status: fakeXhr.status
};

syncer.clientSync.call(model, 'get', model, options);
syncer.clientSync.call(model, 'read', model, options);

syncErrorHandler.should.have.been.calledOnce;
syncErrorHandler.should.have.been.calledWithExactly(expectedResponse);
Expand All @@ -135,7 +135,7 @@ describe('syncer', function() {

fakeXhr.getResponseHeader.withArgs('content-type').returns('application/json');

syncer.clientSync.call(model, 'get', model, options);
syncer.clientSync.call(model, 'read', model, options);

syncErrorHandler.should.have.been.calledOnce;
syncErrorHandler.should.have.been.calledWithExactly(expectedResponse);
Expand Down

0 comments on commit f6a75f5

Please sign in to comment.