From d6ad276f9e75d98a06a84a286f195a173c595bc8 Mon Sep 17 00:00:00 2001 From: bmac Date: Fri, 3 Jul 2015 09:04:45 -0400 Subject: [PATCH] Default to using the JSONAPIAdapter --- packages/ember-data/lib/system/store.js | 4 ++-- .../lib/system/store/container-instance-cache.js | 4 ---- .../ember-data/tests/integration/application-test.js | 11 +++++++++++ .../tests/unit/store/adapter-interop-test.js | 8 -------- 4 files changed, 13 insertions(+), 14 deletions(-) diff --git a/packages/ember-data/lib/system/store.js b/packages/ember-data/lib/system/store.js index a0043fd2f51..0a0451944f2 100644 --- a/packages/ember-data/lib/system/store.js +++ b/packages/ember-data/lib/system/store.js @@ -238,7 +238,7 @@ Store = Service.extend({ @default DS.RESTAdapter @type {(DS.Adapter|String)} */ - adapter: '-rest', + adapter: '-json-api', /** Returns a JSON representation of the record using a custom @@ -2212,7 +2212,7 @@ Store = Service.extend({ _adapterFallbacks: Ember.computed('adapter', function() { var adapter = this.get('adapter'); - return ['application', adapter, '-rest']; + return ['application', adapter, '-json-api']; }), lookupSerializer: function(name, fallbacks) { diff --git a/packages/ember-data/lib/system/store/container-instance-cache.js b/packages/ember-data/lib/system/store/container-instance-cache.js index 0bd8de759ad..999a6d0bd28 100644 --- a/packages/ember-data/lib/system/store/container-instance-cache.js +++ b/packages/ember-data/lib/system/store/container-instance-cache.js @@ -52,10 +52,6 @@ Ember.merge(ContainerInstanceCache.prototype, { }, instanceFor: function(key) { - if (key === 'adapter:-rest') { - Ember.deprecate('You are currently using the default DS.RESTAdapter adapter. For Ember 2.0 the default adapter will be DS.JSONAPIAdapter. If you would like to continue using DS.RESTAdapter please create an application adapter that extends DS.RESTAdapter.'); - } - let cache = this._cache; if (!cache[key]) { let instance = this._container.lookup(key); diff --git a/packages/ember-data/tests/integration/application-test.js b/packages/ember-data/tests/integration/application-test.js index 5af56586262..46ad96509e6 100644 --- a/packages/ember-data/tests/integration/application-test.js +++ b/packages/ember-data/tests/integration/application-test.js @@ -76,6 +76,17 @@ test("registering App.Store is deprecated but functional", function() { }); }); +test("The JSONAPIAdapter is the default adapter when no custom adapter is provided", function() { + run(function() { + var store = getStore(); + + var adapter = store.adapterFor('application'); + + ok(adapter instanceof DS.JSONAPIAdapter, 'default adapter should be the JSONAPIAdapter'); + }); +}); + + module("integration/application - Injecting the Default Store", { setup: function() { run(function() { diff --git a/packages/ember-data/tests/unit/store/adapter-interop-test.js b/packages/ember-data/tests/unit/store/adapter-interop-test.js index 8592737964f..5f679964beb 100644 --- a/packages/ember-data/tests/unit/store/adapter-interop-test.js +++ b/packages/ember-data/tests/unit/store/adapter-interop-test.js @@ -27,14 +27,6 @@ test('Adapter can be set as a name', function() { ok(store.get('defaultAdapter') instanceof DS.RESTAdapter); }); -test('Default RESTAdapter has been deprecated', function() { - expectDeprecation(function() { - run(function() { - store = createStore({ adapter: '-rest' }); - }); - }, /You are currently using the default DS.RESTAdapter adapter. For Ember 2.0 the default adapter will be DS.JSONAPIAdapter. If you would like to continue using DS.RESTAdapter please create an application adapter that extends DS.RESTAdapter./); -}); - test('Adapter can not be set as an instance', function() { expect(1);