I have recently managed to get my ember-auth tests to pass, but it's not yet perfect, as the tests fail every second time (or if there are several tests running, every second test about authentication fails).
I have created a small sample app to demonstrate the failure.
You should be able to reproduce the failure by following these steps:
1. git clone https://github.com/pedrokost/ember_auth_testing_example.git
2. cd ember_auth_testing_example
3. ruby -run -e httpd . -p5000 # (or any HTTP server like: python -m SimpleHTTPServer)
4. Open http://localhost:5000?test in the browser
If the tests passes, refresh the page and see it fail with "Invalid JSON format". Next time you refresh it works again.
I had this exact problem when using local storage to save my session. This is because the ember-testing does not clear local storage by default. There are at least three ways to solve this:
The first solution seems to be the simplest and best solution since it's possible to set the storage to just for Ember Auth. The ember-auth documentation explains storage options:
Cookie
Dummy (for unit tests)
You would want to set yours to Dummy in your initialization if
Ember.testing === true