Skip to content

Commit

Permalink
Add missing urlForFindQueryRecord to BuildUrlMixin
Browse files Browse the repository at this point in the history
  • Loading branch information
HeroicEric committed Jul 29, 2015
1 parent fb79a08 commit 095b32f
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
12 changes: 12 additions & 0 deletions packages/ember-data/lib/adapters/build-url-mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ export default Ember.Mixin.create({
return this.urlForFindAll(modelName);
case 'query':
return this.urlForQuery(query, modelName);
case 'queryRecord':
return this.urlForQueryRecord(query, modelName);
case 'findMany':
return this.urlForFindMany(id, modelName, snapshot);
case 'findHasMany':
Expand Down Expand Up @@ -133,6 +135,16 @@ export default Ember.Mixin.create({
return this._buildURL(modelName);
},

/**
* @method urlForQueryRecord
* @param {Object} query
* @param {String} modelName
* @return {String} url
*/
urlForQueryRecord: function(query, modelName) {
return this._buildURL(modelName);
},

/**
* @method urlForFindMany
* @param {Array} ids
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,18 @@ test('buildURL - query requestType delegates to urlForQuery', function() {
equal(adapter.buildURL('super-user', null, null, 'query', queryStub), '/superUsers');
});

test('buildURL - queryRecord requestType delegates to urlForQueryRecord', function() {
expect(3);
var originalMethod = adapter.urlForQueryRecord;
var queryStub = { companyId: 10 };
adapter.urlForQueryRecord = function(query, type) {
equal(query, queryStub);
equal(type, 'super-user');
return originalMethod.apply(this, arguments);
};
equal(adapter.buildURL('super-user', null, null, 'queryRecord', queryStub), '/superUsers');
});

test('buildURL - findMany requestType delegates to urlForFindMany', function() {
expect(3);
var originalMethod = adapter.urlForFindMany;
Expand Down

0 comments on commit 095b32f

Please sign in to comment.