It’s possible to use ember mirage only for tests?
Currently I set another namespace variable in test environment.
http://localhost:4202/tokens >>> Called in the running application
http://localhost:4202/test/tokens >>> Namespace "/test" is set for test environment only
After installing ember-cli-mirage ALL requests are redirected by ember mirage.
For our application we have real requests to a gateway. We only need ember mirage for testing.
Is this possible?
In my environment “development” ( in my Application ) the defined mirage rules will used correctly.
But in my acceptance test mirage writes an error:
'Mirage: Your Ember app tried to POST \'http://localhost:4202/tokens\',\n but there was no route defined to handle this request.\n Define a route the at matches this path in your\n mirage/config.js file. Did you forget to add your namespace?' { description: 'Mirage: undefined', message: 'Mirage: Your Ember app tried to POST 'http://localhost:4202/tokens\',\n but there was no route defined to handle this request.\n Define a route that matches this path in your\n mirage/config.js file. Did you forget to add your namespace?', name: 'Error', stack: 'Mirage: Error: Your Ember app tried to POST \'http://localhost:4202/tokens\',\n but there was no route defined to handle this request.\n D efine a route that matches this path in your\n mirage/config.js file. Did you forget to add your namespace?\n at new MirageError (http://localhost:4203/a ssets/vendor.js:132407:21)\n at assert http://localhost:4203/assets/vendor.js:132394:13)\n at Pretender.unhandledRequest (http://localhost:4203/assets/vendor [Press ENTER to run tests; q to quit; p to pause]
Currently in both use cases I used no different namespace. ( both the same )
In the app all is fine. In the test mirage do not find my defined mirage routes.
Any ideas?
[EDIT]
In my acceptance test there is this route definition set on first line:
Are you sure that’s the only test that access to that route? In the documentation says that the handler server.post only works for that specific test:
This route handler definition is only in effect for the duration of this test, so as soon as it’s over any handler you have defined for POST to /questions in your config.js file will be used again.