From 47b428fecf4fc38cee44732c794af9318d28a402 Mon Sep 17 00:00:00 2001 From: Trevor John Date: Wed, 6 Apr 2016 13:06:54 -0400 Subject: [PATCH] [BUGFIX beta] pass DS.SnapshotRecordArray to urlForFindAll --- addon/-private/adapters/build-url-mixin.js | 5 +++-- tests/unit/adapters/build-url-mixin/build-url-test.js | 8 +++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/addon/-private/adapters/build-url-mixin.js b/addon/-private/adapters/build-url-mixin.js index cdded53d58a..4d8ca008346 100644 --- a/addon/-private/adapters/build-url-mixin.js +++ b/addon/-private/adapters/build-url-mixin.js @@ -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': @@ -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); }, diff --git a/tests/unit/adapters/build-url-mixin/build-url-test.js b/tests/unit/adapters/build-url-mixin/build-url-test.js index 866fcf787b7..152bba1e9dc 100644 --- a/tests/unit/adapters/build-url-mixin/build-url-test.js +++ b/tests/unit/adapters/build-url-mixin/build-url-test.js @@ -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) {