Run before,afterAlls as 'eachs' when specifying runnablesToRun

- Fix bug where beforeAlls were being mutated in Suite#execute
- When Env.execute() receives a list of runnables, beforeAlls and
  afterAlls are collected as beforeEachs and afterEachs. This allows
  runnables to be specified in any order, regardless of if any of them
  have before/afterAlls.
- Spec constructor takes a single function that returns both before and
  afters, instead of two functions. This breaks the current interface
  for constructing a Spec.

[#73742528]
This commit is contained in:
Greg Cobb and Tim Jarratt
2014-08-28 11:21:41 -07:00
committed by Greg Cobb and Tim Jarratt
parent 61bf9ac7d7
commit b984ff2fa6
6 changed files with 65 additions and 27 deletions

View File

@@ -5,8 +5,7 @@ getJasmineRequireObj().Spec = function(j$) {
this.id = attrs.id;
this.description = attrs.description || '';
this.queueableFn = attrs.queueableFn;
this.beforeFns = attrs.beforeFns || function() { return []; };
this.afterFns = attrs.afterFns || function() { return []; };
this.beforeAndAfterFns = attrs.beforeAndAfterFns || function() { return {befores: [], afters: []}; };
this.userContext = attrs.userContext || function() { return {}; };
this.onStart = attrs.onStart || function() {};
this.exceptionFormatter = attrs.exceptionFormatter || function() {};
@@ -48,7 +47,8 @@ getJasmineRequireObj().Spec = function(j$) {
return;
}
var allFns = this.beforeFns().concat(this.queueableFn).concat(this.afterFns());
var fns = this.beforeAndAfterFns();
var allFns = fns.befores.concat(this.queueableFn).concat(fns.afters);
this.queueRunnerFactory({
queueableFns: allFns,