Skip to content

Instantly share code, notes, and snippets.

@rwjblue
Last active February 12, 2018 14:48
Show Gist options
  • Save rwjblue/bbfa75170ea7287a3dc71c9c647f4f4e to your computer and use it in GitHub Desktop.
Save rwjblue/bbfa75170ea7287a3dc71c9c647f4f4e to your computer and use it in GitHub Desktop.
export function setupTest(options) {
let originalContext = {};
beforeEach(function() {
Ember.assign(originalContext, this);
return setupContext(this, options).then(() => {
// *** FIXME ***
let originalPauseTest = this.pauseTest;
this.pauseTest = function Mocha_pauseTest() {
this.timeout(-1); // prevent the test from timing out
return originalPauseTest.call(this);
};
});
});
afterEach(function() {
return teardownContext(this).then(() => {
// delete any extraneous properties
for (let key in this) {
if (!(key in originalContext)) {
delete this[key];
}
}
// copy over the original values
Ember.assign(this, originalContext);
});
});
}
export function setupRenderingTest(options) {
setupTest(options);
beforeEach(function() {
return setupRenderingContext(this);
});
afterEach(function() {
return teardownRenderingContext(this);
});
}
export function setupApplicationTest(options) {
setupTest(options);
beforeEach(function() {
return setupApplicationContext(this);
});
afterEach(function() {
return teardownApplicationContext(this);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment