From 1dcd2d903b3dfb09918187e860cdf8807ca72bd2 Mon Sep 17 00:00:00 2001 From: Wojciech Zawistowski Date: Tue, 5 Nov 2013 17:42:37 +0100 Subject: [PATCH] enhances integration test helper with the ability to invoke additional setup / teardown code --- test/javascripts/helpers/qunit_helpers.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/test/javascripts/helpers/qunit_helpers.js b/test/javascripts/helpers/qunit_helpers.js index be6e4222550..c1eb80f82f8 100644 --- a/test/javascripts/helpers/qunit_helpers.js +++ b/test/javascripts/helpers/qunit_helpers.js @@ -1,12 +1,20 @@ -function integration(name) { +function integration(name, lifecycle) { module("Integration: " + name, { setup: function() { sinon.stub(Discourse.ScrollingDOMMethods, "bindOnScroll"); sinon.stub(Discourse.ScrollingDOMMethods, "unbindOnScroll"); Ember.run(Discourse, Discourse.advanceReadiness); + + if (lifecycle && lifecycle.setup) { + lifecycle.setup.call(this); + } }, teardown: function() { + if (lifecycle && lifecycle.teardown) { + lifecycle.teardown.call(this); + } + Discourse.reset(); Discourse.ScrollingDOMMethods.bindOnScroll.restore(); Discourse.ScrollingDOMMethods.unbindOnScroll.restore();