Skip to content

Commit c589300

Browse files
committed
Use jasmineEnv.currentSpec instead of this
This avoids any weirdness with binding runPitTest, and is more consistent with how .runs() and .waitsFor() were being called.
1 parent a566152 commit c589300

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

index.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ function install(globalObject) {
2323

2424
function runPitTest(promiseBuilder) {
2525
var jasmineEnv = jasmine.getEnv();
26-
var spec = this;
26+
var spec = jasmineEnv.currentSpec;
2727
var isFinished = false;
2828
var error = null;
2929

30-
jasmineEnv.currentSpec.runs(function() {
30+
spec.runs(function() {
3131
try {
3232
var promise = promiseBuilder.call(spec);
3333
if (!promise || !promise.then) {
@@ -45,8 +45,8 @@ function install(globalObject) {
4545
}
4646
});
4747

48-
jasmineEnv.currentSpec.waitsFor(function() { return isFinished; });
49-
jasmineEnv.currentSpec.runs(function() { if (error) throw error; });
48+
spec.waitsFor(function() { return isFinished; });
49+
spec.runs(function() { if (error) throw error; });
5050
};
5151
}
5252

0 commit comments

Comments
 (0)