Ghost/ghost/admin/tests/helpers/adapter-error.js
Kevin Ansfield 983110d931 Switched from ember-cli-shims to new module imports (#779)
no issue

- add eslint-plugin-ember, configure no-old-shims rule
- run `eslint --fix` on `app`, `lib`, `mirage`, and `tests` to move imports to the new module imports
- further cleanup of Ember globals usage
- remove event-dispatcher initializer now that `canDispatchToEventManager` is deprecated
2017-08-22 14:53:26 +07:00

23 lines
661 B
JavaScript

import Ember from 'ember';
import Test from 'ember-test'; // eslint-disable-line
// This is needed for testing error responses in acceptance tests
// See http://williamsbdev.com/posts/testing-rsvp-errors-handled-globally/
// ember-cli-shims doesn't export Logger
const {Logger} = Ember;
let originalException, originalLoggerError;
export function errorOverride() {
originalException = Test.adapter.exception;
originalLoggerError = Logger.error;
Test.adapter.exception = function () {};
Logger.error = function () {};
}
export function errorReset() {
Test.adapter.exception = originalException;
Logger.error = originalLoggerError;
}