jasmine 0.10.3.5 → 0.10.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -57,6 +57,10 @@ jasmine.MessageResult = function(text) {
57
57
  this.trace = new Error(); // todo: test better
58
58
  };
59
59
 
60
+ jasmine.MessageResult.prototype.toString = function() {
61
+ return this.text;
62
+ };
63
+
60
64
  jasmine.ExpectationResult = function(params) {
61
65
  this.type = 'ExpectationResult';
62
66
  this.matcherName = params.matcherName;
@@ -71,6 +75,10 @@ jasmine.ExpectationResult = function(params) {
71
75
  this.trace = this.passed_ ? '' : new Error(this.message);
72
76
  };
73
77
 
78
+ jasmine.ExpectationResult.prototype.toString = function () {
79
+ return this.message;
80
+ };
81
+
74
82
  jasmine.ExpectationResult.prototype.passed = function () {
75
83
  return this.passed_;
76
84
  };
@@ -741,10 +749,21 @@ jasmine.Env.prototype.describe = function(description, specDefinitions) {
741
749
 
742
750
  this.currentSuite = suite;
743
751
 
744
- specDefinitions.call(suite);
752
+ var declarationError = null;
753
+ try {
754
+ specDefinitions.call(suite);
755
+ } catch(e) {
756
+ declarationError = e;
757
+ }
745
758
 
746
759
  this.currentSuite = parentSuite;
747
760
 
761
+ if (declarationError) {
762
+ this.it("encountered a declaration exception", function() {
763
+ throw declarationError;
764
+ });
765
+ }
766
+
748
767
  return suite;
749
768
  };
750
769
 
@@ -1777,12 +1796,12 @@ jasmine.Runner.prototype.execute = function() {
1777
1796
 
1778
1797
  jasmine.Runner.prototype.beforeEach = function(beforeEachFunction) {
1779
1798
  beforeEachFunction.typeName = 'beforeEach';
1780
- this.before_.push(beforeEachFunction);
1799
+ this.before_.splice(0,0,beforeEachFunction);
1781
1800
  };
1782
1801
 
1783
1802
  jasmine.Runner.prototype.afterEach = function(afterEachFunction) {
1784
1803
  afterEachFunction.typeName = 'afterEach';
1785
- this.after_.push(afterEachFunction);
1804
+ this.after_.splice(0,0,afterEachFunction);
1786
1805
  };
1787
1806
 
1788
1807
 
@@ -2063,12 +2082,12 @@ jasmine.Suite.prototype.finish = function(onComplete) {
2063
2082
 
2064
2083
  jasmine.Suite.prototype.beforeEach = function(beforeEachFunction) {
2065
2084
  beforeEachFunction.typeName = 'beforeEach';
2066
- this.before_.push(beforeEachFunction);
2085
+ this.before_.unshift(beforeEachFunction);
2067
2086
  };
2068
2087
 
2069
2088
  jasmine.Suite.prototype.afterEach = function(afterEachFunction) {
2070
2089
  afterEachFunction.typeName = 'afterEach';
2071
- this.after_.push(afterEachFunction);
2090
+ this.after_.unshift(afterEachFunction);
2072
2091
  };
2073
2092
 
2074
2093
  jasmine.Suite.prototype.results = function() {
@@ -2139,193 +2158,192 @@ jasmine.WaitsForBlock.prototype.execute = function (onComplete) {
2139
2158
  name: 'timeout',
2140
2159
  message: message
2141
2160
  });
2142
- self.spec._next();
2143
2161
  } else {
2144
2162
  self.totalTimeSpentWaitingForLatch += jasmine.WaitsForBlock.TIMEOUT_INCREMENT;
2145
2163
  self.env.setTimeout(function () { self.execute(onComplete); }, jasmine.WaitsForBlock.TIMEOUT_INCREMENT);
2146
2164
  }
2147
2165
  };
2148
- // Mock setTimeout, clearTimeout
2149
- // Contributed by Pivotal Computer Systems, www.pivotalsf.com
2150
-
2151
- jasmine.FakeTimer = function() {
2152
- this.reset();
2153
-
2154
- var self = this;
2155
- self.setTimeout = function(funcToCall, millis) {
2156
- self.timeoutsMade++;
2157
- self.scheduleFunction(self.timeoutsMade, funcToCall, millis, false);
2158
- return self.timeoutsMade;
2159
- };
2160
-
2161
- self.setInterval = function(funcToCall, millis) {
2162
- self.timeoutsMade++;
2163
- self.scheduleFunction(self.timeoutsMade, funcToCall, millis, true);
2164
- return self.timeoutsMade;
2165
- };
2166
-
2167
- self.clearTimeout = function(timeoutKey) {
2168
- self.scheduledFunctions[timeoutKey] = jasmine.undefined;
2169
- };
2170
-
2171
- self.clearInterval = function(timeoutKey) {
2172
- self.scheduledFunctions[timeoutKey] = jasmine.undefined;
2173
- };
2174
-
2175
- };
2176
-
2177
- jasmine.FakeTimer.prototype.reset = function() {
2178
- this.timeoutsMade = 0;
2179
- this.scheduledFunctions = {};
2180
- this.nowMillis = 0;
2181
- };
2182
-
2183
- jasmine.FakeTimer.prototype.tick = function(millis) {
2184
- var oldMillis = this.nowMillis;
2185
- var newMillis = oldMillis + millis;
2186
- this.runFunctionsWithinRange(oldMillis, newMillis);
2187
- this.nowMillis = newMillis;
2188
- };
2189
-
2190
- jasmine.FakeTimer.prototype.runFunctionsWithinRange = function(oldMillis, nowMillis) {
2191
- var scheduledFunc;
2192
- var funcsToRun = [];
2193
- for (var timeoutKey in this.scheduledFunctions) {
2194
- scheduledFunc = this.scheduledFunctions[timeoutKey];
2195
- if (scheduledFunc != jasmine.undefined &&
2196
- scheduledFunc.runAtMillis >= oldMillis &&
2197
- scheduledFunc.runAtMillis <= nowMillis) {
2198
- funcsToRun.push(scheduledFunc);
2199
- this.scheduledFunctions[timeoutKey] = jasmine.undefined;
2200
- }
2201
- }
2202
-
2203
- if (funcsToRun.length > 0) {
2204
- funcsToRun.sort(function(a, b) {
2205
- return a.runAtMillis - b.runAtMillis;
2206
- });
2207
- for (var i = 0; i < funcsToRun.length; ++i) {
2208
- try {
2209
- var funcToRun = funcsToRun[i];
2210
- this.nowMillis = funcToRun.runAtMillis;
2211
- funcToRun.funcToCall();
2212
- if (funcToRun.recurring) {
2213
- this.scheduleFunction(funcToRun.timeoutKey,
2214
- funcToRun.funcToCall,
2215
- funcToRun.millis,
2216
- true);
2217
- }
2218
- } catch(e) {
2219
- }
2220
- }
2221
- this.runFunctionsWithinRange(oldMillis, nowMillis);
2222
- }
2223
- };
2224
-
2225
- jasmine.FakeTimer.prototype.scheduleFunction = function(timeoutKey, funcToCall, millis, recurring) {
2226
- this.scheduledFunctions[timeoutKey] = {
2227
- runAtMillis: this.nowMillis + millis,
2228
- funcToCall: funcToCall,
2229
- recurring: recurring,
2230
- timeoutKey: timeoutKey,
2231
- millis: millis
2232
- };
2233
- };
2234
-
2235
- /**
2236
- * @namespace
2237
- */
2238
- jasmine.Clock = {
2239
- defaultFakeTimer: new jasmine.FakeTimer(),
2240
-
2241
- reset: function() {
2242
- jasmine.Clock.assertInstalled();
2243
- jasmine.Clock.defaultFakeTimer.reset();
2244
- },
2245
-
2246
- tick: function(millis) {
2247
- jasmine.Clock.assertInstalled();
2248
- jasmine.Clock.defaultFakeTimer.tick(millis);
2249
- },
2250
-
2251
- runFunctionsWithinRange: function(oldMillis, nowMillis) {
2252
- jasmine.Clock.defaultFakeTimer.runFunctionsWithinRange(oldMillis, nowMillis);
2253
- },
2254
-
2255
- scheduleFunction: function(timeoutKey, funcToCall, millis, recurring) {
2256
- jasmine.Clock.defaultFakeTimer.scheduleFunction(timeoutKey, funcToCall, millis, recurring);
2257
- },
2258
-
2259
- useMock: function() {
2260
- var spec = jasmine.getEnv().currentSpec;
2261
- spec.after(jasmine.Clock.uninstallMock);
2262
-
2263
- jasmine.Clock.installMock();
2264
- },
2265
-
2266
- installMock: function() {
2267
- jasmine.Clock.installed = jasmine.Clock.defaultFakeTimer;
2268
- },
2269
-
2270
- uninstallMock: function() {
2271
- jasmine.Clock.assertInstalled();
2272
- jasmine.Clock.installed = jasmine.Clock.real;
2273
- },
2274
-
2275
- real: {
2276
- setTimeout: window.setTimeout,
2277
- clearTimeout: window.clearTimeout,
2278
- setInterval: window.setInterval,
2279
- clearInterval: window.clearInterval
2280
- },
2281
-
2282
- assertInstalled: function() {
2283
- if (jasmine.Clock.installed != jasmine.Clock.defaultFakeTimer) {
2284
- throw new Error("Mock clock is not installed, use jasmine.Clock.useMock()");
2285
- }
2286
- },
2287
-
2288
- installed: null
2289
- };
2290
- jasmine.Clock.installed = jasmine.Clock.real;
2291
-
2292
- //else for IE support
2293
- window.setTimeout = function(funcToCall, millis) {
2294
- if (jasmine.Clock.installed.setTimeout.apply) {
2295
- return jasmine.Clock.installed.setTimeout.apply(this, arguments);
2296
- } else {
2297
- return jasmine.Clock.installed.setTimeout(funcToCall, millis);
2298
- }
2299
- };
2300
-
2301
- window.setInterval = function(funcToCall, millis) {
2302
- if (jasmine.Clock.installed.setInterval.apply) {
2303
- return jasmine.Clock.installed.setInterval.apply(this, arguments);
2304
- } else {
2305
- return jasmine.Clock.installed.setInterval(funcToCall, millis);
2306
- }
2307
- };
2308
-
2309
- window.clearTimeout = function(timeoutKey) {
2310
- if (jasmine.Clock.installed.clearTimeout.apply) {
2311
- return jasmine.Clock.installed.clearTimeout.apply(this, arguments);
2312
- } else {
2313
- return jasmine.Clock.installed.clearTimeout(timeoutKey);
2314
- }
2315
- };
2316
-
2317
- window.clearInterval = function(timeoutKey) {
2318
- if (jasmine.Clock.installed.clearTimeout.apply) {
2319
- return jasmine.Clock.installed.clearInterval.apply(this, arguments);
2320
- } else {
2321
- return jasmine.Clock.installed.clearInterval(timeoutKey);
2322
- }
2323
- };
2324
-
2166
+ // Mock setTimeout, clearTimeout
2167
+ // Contributed by Pivotal Computer Systems, www.pivotalsf.com
2168
+
2169
+ jasmine.FakeTimer = function() {
2170
+ this.reset();
2171
+
2172
+ var self = this;
2173
+ self.setTimeout = function(funcToCall, millis) {
2174
+ self.timeoutsMade++;
2175
+ self.scheduleFunction(self.timeoutsMade, funcToCall, millis, false);
2176
+ return self.timeoutsMade;
2177
+ };
2178
+
2179
+ self.setInterval = function(funcToCall, millis) {
2180
+ self.timeoutsMade++;
2181
+ self.scheduleFunction(self.timeoutsMade, funcToCall, millis, true);
2182
+ return self.timeoutsMade;
2183
+ };
2184
+
2185
+ self.clearTimeout = function(timeoutKey) {
2186
+ self.scheduledFunctions[timeoutKey] = jasmine.undefined;
2187
+ };
2188
+
2189
+ self.clearInterval = function(timeoutKey) {
2190
+ self.scheduledFunctions[timeoutKey] = jasmine.undefined;
2191
+ };
2192
+
2193
+ };
2194
+
2195
+ jasmine.FakeTimer.prototype.reset = function() {
2196
+ this.timeoutsMade = 0;
2197
+ this.scheduledFunctions = {};
2198
+ this.nowMillis = 0;
2199
+ };
2200
+
2201
+ jasmine.FakeTimer.prototype.tick = function(millis) {
2202
+ var oldMillis = this.nowMillis;
2203
+ var newMillis = oldMillis + millis;
2204
+ this.runFunctionsWithinRange(oldMillis, newMillis);
2205
+ this.nowMillis = newMillis;
2206
+ };
2207
+
2208
+ jasmine.FakeTimer.prototype.runFunctionsWithinRange = function(oldMillis, nowMillis) {
2209
+ var scheduledFunc;
2210
+ var funcsToRun = [];
2211
+ for (var timeoutKey in this.scheduledFunctions) {
2212
+ scheduledFunc = this.scheduledFunctions[timeoutKey];
2213
+ if (scheduledFunc != jasmine.undefined &&
2214
+ scheduledFunc.runAtMillis >= oldMillis &&
2215
+ scheduledFunc.runAtMillis <= nowMillis) {
2216
+ funcsToRun.push(scheduledFunc);
2217
+ this.scheduledFunctions[timeoutKey] = jasmine.undefined;
2218
+ }
2219
+ }
2220
+
2221
+ if (funcsToRun.length > 0) {
2222
+ funcsToRun.sort(function(a, b) {
2223
+ return a.runAtMillis - b.runAtMillis;
2224
+ });
2225
+ for (var i = 0; i < funcsToRun.length; ++i) {
2226
+ try {
2227
+ var funcToRun = funcsToRun[i];
2228
+ this.nowMillis = funcToRun.runAtMillis;
2229
+ funcToRun.funcToCall();
2230
+ if (funcToRun.recurring) {
2231
+ this.scheduleFunction(funcToRun.timeoutKey,
2232
+ funcToRun.funcToCall,
2233
+ funcToRun.millis,
2234
+ true);
2235
+ }
2236
+ } catch(e) {
2237
+ }
2238
+ }
2239
+ this.runFunctionsWithinRange(oldMillis, nowMillis);
2240
+ }
2241
+ };
2242
+
2243
+ jasmine.FakeTimer.prototype.scheduleFunction = function(timeoutKey, funcToCall, millis, recurring) {
2244
+ this.scheduledFunctions[timeoutKey] = {
2245
+ runAtMillis: this.nowMillis + millis,
2246
+ funcToCall: funcToCall,
2247
+ recurring: recurring,
2248
+ timeoutKey: timeoutKey,
2249
+ millis: millis
2250
+ };
2251
+ };
2252
+
2253
+ /**
2254
+ * @namespace
2255
+ */
2256
+ jasmine.Clock = {
2257
+ defaultFakeTimer: new jasmine.FakeTimer(),
2258
+
2259
+ reset: function() {
2260
+ jasmine.Clock.assertInstalled();
2261
+ jasmine.Clock.defaultFakeTimer.reset();
2262
+ },
2263
+
2264
+ tick: function(millis) {
2265
+ jasmine.Clock.assertInstalled();
2266
+ jasmine.Clock.defaultFakeTimer.tick(millis);
2267
+ },
2268
+
2269
+ runFunctionsWithinRange: function(oldMillis, nowMillis) {
2270
+ jasmine.Clock.defaultFakeTimer.runFunctionsWithinRange(oldMillis, nowMillis);
2271
+ },
2272
+
2273
+ scheduleFunction: function(timeoutKey, funcToCall, millis, recurring) {
2274
+ jasmine.Clock.defaultFakeTimer.scheduleFunction(timeoutKey, funcToCall, millis, recurring);
2275
+ },
2276
+
2277
+ useMock: function() {
2278
+ var spec = jasmine.getEnv().currentSpec;
2279
+ spec.after(jasmine.Clock.uninstallMock);
2280
+
2281
+ jasmine.Clock.installMock();
2282
+ },
2283
+
2284
+ installMock: function() {
2285
+ jasmine.Clock.installed = jasmine.Clock.defaultFakeTimer;
2286
+ },
2287
+
2288
+ uninstallMock: function() {
2289
+ jasmine.Clock.assertInstalled();
2290
+ jasmine.Clock.installed = jasmine.Clock.real;
2291
+ },
2292
+
2293
+ real: {
2294
+ setTimeout: window.setTimeout,
2295
+ clearTimeout: window.clearTimeout,
2296
+ setInterval: window.setInterval,
2297
+ clearInterval: window.clearInterval
2298
+ },
2299
+
2300
+ assertInstalled: function() {
2301
+ if (jasmine.Clock.installed != jasmine.Clock.defaultFakeTimer) {
2302
+ throw new Error("Mock clock is not installed, use jasmine.Clock.useMock()");
2303
+ }
2304
+ },
2305
+
2306
+ installed: null
2307
+ };
2308
+ jasmine.Clock.installed = jasmine.Clock.real;
2309
+
2310
+ //else for IE support
2311
+ window.setTimeout = function(funcToCall, millis) {
2312
+ if (jasmine.Clock.installed.setTimeout.apply) {
2313
+ return jasmine.Clock.installed.setTimeout.apply(this, arguments);
2314
+ } else {
2315
+ return jasmine.Clock.installed.setTimeout(funcToCall, millis);
2316
+ }
2317
+ };
2318
+
2319
+ window.setInterval = function(funcToCall, millis) {
2320
+ if (jasmine.Clock.installed.setInterval.apply) {
2321
+ return jasmine.Clock.installed.setInterval.apply(this, arguments);
2322
+ } else {
2323
+ return jasmine.Clock.installed.setInterval(funcToCall, millis);
2324
+ }
2325
+ };
2326
+
2327
+ window.clearTimeout = function(timeoutKey) {
2328
+ if (jasmine.Clock.installed.clearTimeout.apply) {
2329
+ return jasmine.Clock.installed.clearTimeout.apply(this, arguments);
2330
+ } else {
2331
+ return jasmine.Clock.installed.clearTimeout(timeoutKey);
2332
+ }
2333
+ };
2334
+
2335
+ window.clearInterval = function(timeoutKey) {
2336
+ if (jasmine.Clock.installed.clearTimeout.apply) {
2337
+ return jasmine.Clock.installed.clearInterval.apply(this, arguments);
2338
+ } else {
2339
+ return jasmine.Clock.installed.clearInterval(timeoutKey);
2340
+ }
2341
+ };
2342
+
2325
2343
 
2326
2344
  jasmine.version_= {
2327
2345
  "major": 0,
2328
2346
  "minor": 10,
2329
- "build": 3,
2330
- "revision": 1270162784
2347
+ "build": 4,
2348
+ "revision": 1275748595
2331
2349
  };
metadata CHANGED
@@ -5,9 +5,9 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 10
8
- - 3
9
- - 5
10
- version: 0.10.3.5
8
+ - 4
9
+ - 0
10
+ version: 0.10.4.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Rajan Agaskar
@@ -16,10 +16,12 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2010-04-27 00:00:00 -07:00
19
+ date: 2010-06-05 00:00:00 -04:00
20
20
  default_executable: jasmine
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
23
+ name: rspec
24
+ type: :runtime
23
25
  version_requirements: &id001 !ruby/object:Gem::Requirement
24
26
  requirements:
25
27
  - - ">="
@@ -29,11 +31,11 @@ dependencies:
29
31
  - 1
30
32
  - 5
31
33
  version: 1.1.5
32
- name: rspec
33
- requirement: *id001
34
34
  prerelease: false
35
- type: :runtime
35
+ requirement: *id001
36
36
  - !ruby/object:Gem::Dependency
37
+ name: rack
38
+ type: :runtime
37
39
  version_requirements: &id002 !ruby/object:Gem::Requirement
38
40
  requirements:
39
41
  - - ">="
@@ -43,11 +45,11 @@ dependencies:
43
45
  - 0
44
46
  - 0
45
47
  version: 1.0.0
46
- name: rack
47
- requirement: *id002
48
48
  prerelease: false
49
- type: :runtime
49
+ requirement: *id002
50
50
  - !ruby/object:Gem::Dependency
51
+ name: selenium-rc
52
+ type: :runtime
51
53
  version_requirements: &id003 !ruby/object:Gem::Requirement
52
54
  requirements:
53
55
  - - ">="
@@ -57,11 +59,11 @@ dependencies:
57
59
  - 1
58
60
  - 0
59
61
  version: 2.1.0
60
- name: selenium-rc
61
- requirement: *id003
62
62
  prerelease: false
63
- type: :runtime
63
+ requirement: *id003
64
64
  - !ruby/object:Gem::Dependency
65
+ name: selenium-client
66
+ type: :runtime
65
67
  version_requirements: &id004 !ruby/object:Gem::Requirement
66
68
  requirements:
67
69
  - - ">="
@@ -71,10 +73,8 @@ dependencies:
71
73
  - 2
72
74
  - 17
73
75
  version: 1.2.17
74
- name: selenium-client
75
- requirement: *id004
76
76
  prerelease: false
77
- type: :runtime
77
+ requirement: *id004
78
78
  description: Javascript BDD test framework
79
79
  email: ragaskar@gmail.com
80
80
  executables:
@@ -94,7 +94,7 @@ files:
94
94
  - generators/jasmine/templates/spec/javascripts/support/jasmine_runner.rb
95
95
  - jasmine/lib/TrivialReporter.js
96
96
  - jasmine/lib/consolex.js
97
- - jasmine/lib/jasmine-0.10.3.js
97
+ - jasmine/lib/jasmine-0.10.4.js
98
98
  - jasmine/lib/jasmine.css
99
99
  - jasmine/lib/json2.js
100
100
  - lib/jasmine.rb