Inject different adapter with Ember CLI?


#1

Hi,

for our tests, we have a fixture adapter, and we would need to inject this adapter into the main store (but only while executing a test of course). So far, nothing has worked.

We tried:

  1. an initializer that fired before or after the store was injected (which was somewhat ignored by the system).

  2. overshadowing the application adapter and any other defined adapter in tests/helpers/start-app.js

For Point that would look like, placed after Router.reopen({});:

define('app/adapters/<adapter-name>', ['exports'], function(exports) {
exports['default'] = TestAdapter; 
}); 

Used ember-cli setup:

$ ember --version
version: 0.1.1
node: 0.10.28
npm: 2.1.2

Besides that we have two other problems:

First we get a strange routing error after an upgrade to ember-cli 0.1.1 in our tests, is that a ember-cli bug, on our side? We looked at it so far and it seems that it’s an ember-cli issue, but we are still not sure if we should open an issue ticket:

Uncaught Error: Assertion Failed: The URL
'/tests?testNumber=16' did not match any 
routes in your application
Source: http://localhost:4200/assets/vendor.js:41084

Second problem would be this error, which strangely occurs in our tests:

Error: Assertion Failed: You tried to load all records but your adapter 
does not implement `findAll`

I don’t know why this happens, we actually set the used adapter to the DS.FixtureAdapter, which implements findAll. That setting operation seems to get lost somehow and the actual adapter seems to be the default application adapter, which is “-rest”. And which seems not to have findAll, as it is just a string in that context, if I’m reading the debugging output correctly.

Any help with this a little bit complicated mess would be highly appreciated.