From 68bb8d5874683115e74bf9f59069abbaa04a1408 Mon Sep 17 00:00:00 2001 From: Prem Sichanugrist Date: Thu, 5 Jul 2012 21:08:09 -0400 Subject: [PATCH] Patch `window.it` to raise error on pending tests --- cms/static/coffee/spec/helpers.coffee | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/cms/static/coffee/spec/helpers.coffee b/cms/static/coffee/spec/helpers.coffee index a5e24ddf81..374f68f2e8 100644 --- a/cms/static/coffee/spec/helpers.coffee +++ b/cms/static/coffee/spec/helpers.coffee @@ -7,3 +7,12 @@ jQuery.cookie = (key, value) => @stubCookies[key] = value else @stubCookies[key] + +# Path Jasmine's `it` method to raise an error when the test is not defined. +# This is helpful when writing the specs first before writing the test. +@it = (desc, func) -> + if func? + jasmine.getEnv().it(desc, func) + else + jasmine.getEnv().it desc, -> + throw "test is undefined"