Skip to content

Commit

Permalink
[BUGFIX beta] pass DS.SnapshotRecordArray to urlForFindAll
Browse files Browse the repository at this point in the history
  • Loading branch information
trevorrjohn committed Apr 6, 2016
1 parent 8959c4e commit 47b428f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
5 changes: 3 additions & 2 deletions addon/-private/adapters/build-url-mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export default Ember.Mixin.create({
case 'findRecord':
return this.urlForFindRecord(id, modelName, snapshot);
case 'findAll':
return this.urlForFindAll(modelName);
return this.urlForFindAll(modelName, snapshot);
case 'query':
return this.urlForQuery(query, modelName);
case 'queryRecord':
Expand Down Expand Up @@ -121,9 +121,10 @@ export default Ember.Mixin.create({
/**
* @method urlForFindAll
* @param {String} modelName
* @param {DS.SnapshotRecordArray} snapshot
* @return {String} url
*/
urlForFindAll(modelName) {
urlForFindAll(modelName, snapshot) {
return this._buildURL(modelName);
},

Expand Down
8 changes: 5 additions & 3 deletions tests/unit/adapters/build-url-mixin/build-url-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,15 @@ test('buildURL - find requestType delegates to urlForFindRecord', function(asser
});

test('buildURL - findAll requestType delegates to urlForFindAll', function(assert) {
assert.expect(2);
assert.expect(3);
let originalMethod = adapter.urlForFindAll;
adapter.urlForFindAll = function(type) {
let snapshotStub = { snapshot: true };
adapter.urlForFindAll = function(type, snapshot) {
assert.equal(type, 'super-user');
assert.equal(snapshot, snapshotStub);
return originalMethod.apply(this, arguments);
};
assert.equal(adapter.buildURL('super-user', null, null, 'findAll'), '/superUsers');
assert.equal(adapter.buildURL('super-user', null, snapshotStub, 'findAll'), '/superUsers');
});

test('buildURL - query requestType delegates to urlForQuery', function(assert) {
Expand Down

0 comments on commit 47b428f

Please sign in to comment.