diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/jasmine-jstd-adapter/JasmineAdapter.js | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/jasmine-jstd-adapter/JasmineAdapter.js b/lib/jasmine-jstd-adapter/JasmineAdapter.js index ba54251a..0fdc4612 100644 --- a/lib/jasmine-jstd-adapter/JasmineAdapter.js +++ b/lib/jasmine-jstd-adapter/JasmineAdapter.js @@ -9,7 +9,7 @@ function bind(_this, _function){ return function(){ return _function.call(_this); - } + }; } var currentFrame = frame(null, null); @@ -49,14 +49,22 @@ })(jasmine.Env.prototype.describe); + var id = 0; jasmine.Env.prototype.it = (function(it){ return function(desc, itFn){ var self = this; var spec = it.apply(this, arguments); var currentSpec = this.currentSpec; + if (!currentSpec.$id) { + currentSpec.$id = id++; + } var frame = this.jstdFrame = currentFrame; - this.jstdFrame.testCase.prototype['test that it ' + desc] = function(){ + var name = 'test that it ' + desc; + if (this.jstdFrame.testCase.prototype[name]) + throw "Spec with name '" + desc + "' already exists."; + this.jstdFrame.testCase.prototype[name] = function(){ + jasmine.getEnv().currentSpec = currentSpec; frame.runBefore.apply(currentSpec); try { itFn.apply(currentSpec); |
