Skip to content

Commit

Permalink
Tidy up tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom Coquereau committed Jul 2, 2015
1 parent 9ce643a commit 4fb3caf
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions packages/ember-data/lib/system/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -1046,7 +1046,7 @@ Store = Service.extend({
@return {Promise} promise
*/
query: function(modelName, options) {
Ember.assert("You need to pass a namespaced query hash to the store's query method", options && options.query);
Ember.assert("You need to pass a query hash in the options hash of the store's query method", options && options.query);
Ember.assert('Passing classes to store methods has been removed. Please pass a dasherized string instead of '+ Ember.inspect(modelName), typeof modelName === 'string');
var typeClass = this.modelFor(modelName);
var array = this.recordArrayManager
Expand Down Expand Up @@ -1079,7 +1079,7 @@ Store = Service.extend({
queryRecord: function(modelName, options) {
options = options || {};
Ember.assert("You need to pass a type to the store's queryRecord method", modelName);
Ember.assert("You need to pass a namespaced query hash to the store's queryRecord method", options && options.query);
Ember.assert("You need to pass a query hash in the options hash of the store's queryRecord method", options && options.query);
Ember.assert('Passing classes to store methods has been removed. Please pass a dasherized string instead of '+ Ember.inspect(modelName), typeof modelName === 'string');

var typeClass = this.modelFor(modelName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -950,7 +950,7 @@ test("metadata is accessible", function() {
}));
});

test("findQuery - if `sortQueryParams` option is not provided, query params are sorted alphabetically", function() {
test("query - if `sortQueryParams` option is not provided, query params are sorted alphabetically", function() {
adapter.ajax = function(url, verb, hash) {
passedUrl = url;
passedVerb = verb;
Expand All @@ -966,7 +966,7 @@ test("findQuery - if `sortQueryParams` option is not provided, query params are
}));
});

test("findQuery - passes buildURL the requestType", function() {
test("query - passes buildURL the requestType", function() {
adapter.buildURL = function(type, id, snapshot, requestType) {
return "/" + requestType + "/posts";
};
Expand All @@ -982,7 +982,7 @@ test("findQuery - passes buildURL the requestType", function() {
}));
});

test("findQuery - if `sortQueryParams` is falsey, query params are not sorted at all", function() {
test("query - if `sortQueryParams` is falsey, query params are not sorted at all", function() {
adapter.ajax = function(url, verb, hash) {
passedUrl = url;
passedVerb = verb;
Expand All @@ -1000,7 +1000,7 @@ test("findQuery - if `sortQueryParams` is falsey, query params are not sorted at
}));
});

test("findQuery - if `sortQueryParams` is a custom function, query params passed through that function", function() {
test("query - if `sortQueryParams` is a custom function, query params passed through that function", function() {
adapter.ajax = function(url, verb, hash) {
passedUrl = url;
passedVerb = verb;
Expand All @@ -1027,7 +1027,7 @@ test("findQuery - if `sortQueryParams` is a custom function, query params passed
}));
});

test("findQuery - payload 'meta' is accessible on the record array", function() {
test("query - payload 'meta' is accessible on the record array", function() {
ajaxResponse({
meta: { offset: 5 },
posts: [{ id: 1, name: "Rails is very expensive sushi" }]
Expand All @@ -1042,7 +1042,7 @@ test("findQuery - payload 'meta' is accessible on the record array", function()
}));
});

test("findQuery - each record array can have its own meta object", function() {
test("query - each record array can have its own meta object", function() {
ajaxResponse({
meta: { offset: 5 },
posts: [{ id: 1, name: "Rails is very expensive sushi" }]
Expand All @@ -1066,7 +1066,7 @@ test("findQuery - each record array can have its own meta object", function() {
});


test("findQuery - returning an array populates the array", function() {
test("query - returning an array populates the array", function() {
ajaxResponse({
posts: [
{ id: 1, name: "Rails is omakase" },
Expand Down Expand Up @@ -1102,7 +1102,7 @@ test("findQuery - returning an array populates the array", function() {
}));
});

test("findQuery - returning sideloaded data loads the data", function() {
test("query - returning sideloaded data loads the data", function() {
ajaxResponse({
posts: [
{ id: 1, name: "Rails is omakase" },
Expand All @@ -1118,7 +1118,7 @@ test("findQuery - returning sideloaded data loads the data", function() {
}));
});

test("findQuery - data is normalized through custom serializers", function() {
test("query - data is normalized through custom serializers", function() {
env.registry.register('serializer:post', DS.RESTSerializer.extend({
primaryKey: '_ID_',
attrs: { name: '_NAME_' }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ var get = Ember.get;
var Person, env, store, adapter;
var run = Ember.run;

module("integration/adapter/queries - Queries", {
module("integration/store/queries - Queries", {
setup: function() {
Person = DS.Model.extend({
updatedAt: DS.attr('string'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ test("It raises an assertion when no type is passed", function() {
test("It raises an assertion when the query is not namespaced in a hash", function() {
expectAssertion(function() {
store.queryRecord('person', { withRelated: 'posts' });
}, "You need to pass a namespaced query hash to the store's queryRecord method");
}, "You need to pass a query hash in the options hash of the store's queryRecord method");
});

test("When a record is requested, the adapter's queryRecord method should be called.", function() {
Expand Down

0 comments on commit 4fb3caf

Please sign in to comment.