2015-12-04 01:37:23 +03:00
|
|
|
import Ember from 'ember';
|
2017-08-22 10:53:26 +03:00
|
|
|
import Test from 'ember-test'; // eslint-disable-line
|
2015-12-04 01:37:23 +03:00
|
|
|
|
|
|
|
// This is needed for testing error responses in acceptance tests
|
|
|
|
// See http://williamsbdev.com/posts/testing-rsvp-errors-handled-globally/
|
|
|
|
|
2016-06-30 13:21:47 +03:00
|
|
|
// ember-cli-shims doesn't export Logger
|
|
|
|
const {Logger} = Ember;
|
2016-06-11 19:52:36 +03:00
|
|
|
|
2016-11-14 16:16:51 +03:00
|
|
|
let originalException, originalLoggerError;
|
2015-12-04 01:37:23 +03:00
|
|
|
|
|
|
|
export function errorOverride() {
|
2016-06-11 19:52:36 +03:00
|
|
|
originalException = Test.adapter.exception;
|
|
|
|
originalLoggerError = Logger.error;
|
|
|
|
Test.adapter.exception = function () {};
|
|
|
|
Logger.error = function () {};
|
2015-12-04 01:37:23 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
export function errorReset() {
|
2016-06-11 19:52:36 +03:00
|
|
|
Test.adapter.exception = originalException;
|
|
|
|
Logger.error = originalLoggerError;
|
2015-12-04 01:37:23 +03:00
|
|
|
}
|