jasmine-core 2.4.1 → 2.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) hide show
  1. checksums.yaml +4 -4
  2. data/lib/console/console.js +1 -1
  3. data/lib/jasmine-core/boot.js +1 -1
  4. data/lib/jasmine-core/jasmine-html.js +15 -7
  5. data/lib/jasmine-core/jasmine.js +261 -82
  6. data/lib/jasmine-core/node_boot.js +1 -1
  7. data/lib/jasmine-core/spec/console/ConsoleReporterSpec.js +16 -16
  8. data/lib/jasmine-core/spec/core/CallTrackerSpec.js +26 -11
  9. data/lib/jasmine-core/spec/core/ClockSpec.js +61 -42
  10. data/lib/jasmine-core/spec/core/DelayedFunctionSchedulerSpec.js +28 -15
  11. data/lib/jasmine-core/spec/core/EnvSpec.js +8 -8
  12. data/lib/jasmine-core/spec/core/ExceptionFormatterSpec.js +6 -6
  13. data/lib/jasmine-core/spec/core/ExceptionsSpec.js +1 -1
  14. data/lib/jasmine-core/spec/core/ExpectationResultSpec.js +8 -8
  15. data/lib/jasmine-core/spec/core/ExpectationSpec.js +17 -17
  16. data/lib/jasmine-core/spec/core/JsApiReporterSpec.js +14 -14
  17. data/lib/jasmine-core/spec/core/MockDateSpec.js +14 -14
  18. data/lib/jasmine-core/spec/core/PrettyPrintSpec.js +65 -56
  19. data/lib/jasmine-core/spec/core/QueueRunnerSpec.js +32 -18
  20. data/lib/jasmine-core/spec/core/ReportDispatcherSpec.js +27 -3
  21. data/lib/jasmine-core/spec/core/SpecSpec.js +37 -37
  22. data/lib/jasmine-core/spec/core/SpyRegistrySpec.js +46 -7
  23. data/lib/jasmine-core/spec/core/SpySpec.js +11 -11
  24. data/lib/jasmine-core/spec/core/SpyStrategySpec.js +25 -13
  25. data/lib/jasmine-core/spec/core/SuiteSpec.js +25 -25
  26. data/lib/jasmine-core/spec/core/TimerSpec.js +2 -2
  27. data/lib/jasmine-core/spec/core/TreeProcessorSpec.js +26 -26
  28. data/lib/jasmine-core/spec/core/UtilSpec.js +12 -12
  29. data/lib/jasmine-core/spec/core/asymmetric_equality/AnySpec.js +8 -8
  30. data/lib/jasmine-core/spec/core/asymmetric_equality/AnythingSpec.js +7 -7
  31. data/lib/jasmine-core/spec/core/asymmetric_equality/ArrayContainingSpec.js +6 -6
  32. data/lib/jasmine-core/spec/core/asymmetric_equality/ObjectContainingSpec.js +11 -11
  33. data/lib/jasmine-core/spec/core/asymmetric_equality/StringMatchingSpec.js +4 -4
  34. data/lib/jasmine-core/spec/core/formatErrorMsgSpec.js +13 -0
  35. data/lib/jasmine-core/spec/core/integration/CustomMatchersSpec.js +2 -2
  36. data/lib/jasmine-core/spec/core/integration/EnvSpec.js +195 -76
  37. data/lib/jasmine-core/spec/core/integration/SpecRunningSpec.js +20 -21
  38. data/lib/jasmine-core/spec/core/matchers/matchersUtilSpec.js +164 -114
  39. data/lib/jasmine-core/spec/core/matchers/toBeCloseToSpec.js +4 -4
  40. data/lib/jasmine-core/spec/core/matchers/toBeDefinedSpec.js +2 -2
  41. data/lib/jasmine-core/spec/core/matchers/toBeFalsySpec.js +2 -2
  42. data/lib/jasmine-core/spec/core/matchers/toBeGreaterThanOrEqualSpec.js +29 -0
  43. data/lib/jasmine-core/spec/core/matchers/toBeGreaterThanSpec.js +2 -2
  44. data/lib/jasmine-core/spec/core/matchers/toBeLessThanOrEqualSpec.js +29 -0
  45. data/lib/jasmine-core/spec/core/matchers/toBeLessThanSpec.js +2 -2
  46. data/lib/jasmine-core/spec/core/matchers/toBeNaNSpec.js +3 -3
  47. data/lib/jasmine-core/spec/core/matchers/toBeNullSpec.js +2 -2
  48. data/lib/jasmine-core/spec/core/matchers/toBeSpec.js +2 -2
  49. data/lib/jasmine-core/spec/core/matchers/toBeTruthySpec.js +2 -2
  50. data/lib/jasmine-core/spec/core/matchers/toBeUndefinedSpec.js +2 -2
  51. data/lib/jasmine-core/spec/core/matchers/toContainSpec.js +4 -4
  52. data/lib/jasmine-core/spec/core/matchers/toEqualSpec.js +2 -2
  53. data/lib/jasmine-core/spec/core/matchers/toHaveBeenCalledSpec.js +11 -11
  54. data/lib/jasmine-core/spec/core/matchers/toHaveBeenCalledTimesSpec.js +22 -17
  55. data/lib/jasmine-core/spec/core/matchers/toHaveBeenCalledWithSpec.js +11 -10
  56. data/lib/jasmine-core/spec/core/matchers/toMatchSpec.js +7 -6
  57. data/lib/jasmine-core/spec/core/matchers/toThrowErrorSpec.js +24 -24
  58. data/lib/jasmine-core/spec/core/matchers/toThrowSpec.js +9 -8
  59. data/lib/jasmine-core/spec/helpers/defineJasmineUnderTest.js +3 -3
  60. data/lib/jasmine-core/spec/helpers/nodeDefineJasmineUnderTest.js +5 -5
  61. data/lib/jasmine-core/spec/html/HtmlReporterSpec.js +95 -59
  62. data/lib/jasmine-core/spec/html/HtmlSpecFilterSpec.js +3 -3
  63. data/lib/jasmine-core/spec/html/MatchersHtmlSpec.js +1 -1
  64. data/lib/jasmine-core/spec/html/PrettyPrintHtmlSpec.js +4 -4
  65. data/lib/jasmine-core/spec/html/QueryStringSpec.js +5 -5
  66. data/lib/jasmine-core/spec/html/ResultsNodeSpec.js +4 -4
  67. data/lib/jasmine-core/spec/npmPackage/npmPackageSpec.js +2 -2
  68. data/lib/jasmine-core/spec/performance/large_object_test.js +1 -1
  69. data/lib/jasmine-core/version.rb +1 -1
  70. metadata +5 -3
  71. data/lib/jasmine-core/spec/node_suite.js +0 -195
@@ -1,6 +1,6 @@
1
1
  describe("toBeCloseTo", function() {
2
2
  it("passes when within two decimal places by default", function() {
3
- var matcher = j$.matchers.toBeCloseTo(),
3
+ var matcher = jasmineUnderTest.matchers.toBeCloseTo(),
4
4
  result;
5
5
 
6
6
  result = matcher.compare(0, 0);
@@ -11,7 +11,7 @@ describe("toBeCloseTo", function() {
11
11
  });
12
12
 
13
13
  it("fails when not within two decimal places by default", function() {
14
- var matcher = j$.matchers.toBeCloseTo(),
14
+ var matcher = jasmineUnderTest.matchers.toBeCloseTo(),
15
15
  result;
16
16
 
17
17
  result = matcher.compare(0, 0.01);
@@ -19,7 +19,7 @@ describe("toBeCloseTo", function() {
19
19
  });
20
20
 
21
21
  it("accepts an optional precision argument", function() {
22
- var matcher = j$.matchers.toBeCloseTo(),
22
+ var matcher = jasmineUnderTest.matchers.toBeCloseTo(),
23
23
  result;
24
24
 
25
25
  result = matcher.compare(0, 0.1, 0);
@@ -30,7 +30,7 @@ describe("toBeCloseTo", function() {
30
30
  });
31
31
 
32
32
  it("rounds expected values", function() {
33
- var matcher = j$.matchers.toBeCloseTo(),
33
+ var matcher = jasmineUnderTest.matchers.toBeCloseTo(),
34
34
  result;
35
35
 
36
36
  result = matcher.compare(1.23, 1.229);
@@ -1,6 +1,6 @@
1
1
  describe("toBeDefined", function() {
2
2
  it("matches for defined values", function() {
3
- var matcher = j$.matchers.toBeDefined(),
3
+ var matcher = jasmineUnderTest.matchers.toBeDefined(),
4
4
  result;
5
5
 
6
6
 
@@ -9,7 +9,7 @@ describe("toBeDefined", function() {
9
9
  });
10
10
 
11
11
  it("fails when matching undefined values", function() {
12
- var matcher = j$.matchers.toBeDefined(),
12
+ var matcher = jasmineUnderTest.matchers.toBeDefined(),
13
13
  result;
14
14
 
15
15
  result = matcher.compare(void 0);
@@ -1,6 +1,6 @@
1
1
  describe("toBeFalsy", function() {
2
2
  it("passes for 'falsy' values", function() {
3
- var matcher = j$.matchers.toBeFalsy(),
3
+ var matcher = jasmineUnderTest.matchers.toBeFalsy(),
4
4
  result;
5
5
 
6
6
  result = matcher.compare(false);
@@ -20,7 +20,7 @@ describe("toBeFalsy", function() {
20
20
  });
21
21
 
22
22
  it("fails for 'truthy' values", function() {
23
- var matcher = j$.matchers.toBeFalsy(),
23
+ var matcher = jasmineUnderTest.matchers.toBeFalsy(),
24
24
  result;
25
25
 
26
26
  result = matcher.compare(true);
@@ -0,0 +1,29 @@
1
+ describe("toBeGreaterThanOrEqual", function() {
2
+ it("passes when actual >= expected", function() {
3
+ var matcher = jasmineUnderTest.matchers.toBeGreaterThanOrEqual(),
4
+ result;
5
+
6
+ result = matcher.compare(2, 1);
7
+ expect(result.pass).toBe(true);
8
+
9
+ result = matcher.compare(1, 1);
10
+ expect(result.pass).toBe(true);
11
+
12
+ result = matcher.compare(1.0000001, 1);
13
+ expect(result.pass).toBe(true);
14
+
15
+ result = matcher.compare(1.0, 1.0);
16
+ expect(result.pass).toBe(true);
17
+ })
18
+
19
+ it("fails when actual < expected", function() {
20
+ var matcher = jasmineUnderTest.matchers.toBeGreaterThanOrEqual(),
21
+ result;
22
+
23
+ result = matcher.compare(1, 2);
24
+ expect(result.pass).toBe(false);
25
+
26
+ result = matcher.compare(1, 1.0000001);
27
+ expect(result.pass).toBe(false);
28
+ })
29
+ });
@@ -1,6 +1,6 @@
1
1
  describe("toBeGreaterThan", function() {
2
2
  it("passes when actual > expected", function() {
3
- var matcher = j$.matchers.toBeGreaterThan(),
3
+ var matcher = jasmineUnderTest.matchers.toBeGreaterThan(),
4
4
  result;
5
5
 
6
6
  result = matcher.compare(2, 1);
@@ -8,7 +8,7 @@ describe("toBeGreaterThan", function() {
8
8
  });
9
9
 
10
10
  it("fails when actual <= expected", function() {
11
- var matcher = j$.matchers.toBeGreaterThan(),
11
+ var matcher = jasmineUnderTest.matchers.toBeGreaterThan(),
12
12
  result;
13
13
 
14
14
  result = matcher.compare(1, 1);
@@ -0,0 +1,29 @@
1
+ describe("toBeLessThanOrEqual", function() {
2
+ it("passes when actual <= expected", function() {
3
+ var matcher = jasmineUnderTest.matchers.toBeLessThanOrEqual(),
4
+ result;
5
+
6
+ result = matcher.compare(1, 2);
7
+ expect(result.pass).toBe(true);
8
+
9
+ result = matcher.compare(1, 1);
10
+ expect(result.pass).toBe(true);
11
+
12
+ result = matcher.compare(1, 1.0000001);
13
+ expect(result.pass).toBe(true);
14
+
15
+ result = matcher.compare(1.0, 1.0);
16
+ expect(result.pass).toBe(true);
17
+ });
18
+
19
+ it("fails when actual < expected", function() {
20
+ var matcher = jasmineUnderTest.matchers.toBeLessThanOrEqual(),
21
+ result;
22
+
23
+ result = matcher.compare(2, 1);
24
+ expect(result.pass).toBe(false);
25
+
26
+ result = matcher.compare(1.0000001, 1);
27
+ expect(result.pass).toBe(false);
28
+ });
29
+ });
@@ -1,6 +1,6 @@
1
1
  describe("toBeLessThan", function() {
2
2
  it("passes when actual < expected", function() {
3
- var matcher = j$.matchers.toBeLessThan(),
3
+ var matcher = jasmineUnderTest.matchers.toBeLessThan(),
4
4
  result;
5
5
 
6
6
  result = matcher.compare(1, 2);
@@ -8,7 +8,7 @@ describe("toBeLessThan", function() {
8
8
  });
9
9
 
10
10
  it("fails when actual <= expected", function() {
11
- var matcher = j$.matchers.toBeLessThan(),
11
+ var matcher = jasmineUnderTest.matchers.toBeLessThan(),
12
12
  result;
13
13
 
14
14
  result = matcher.compare(1, 1);
@@ -1,6 +1,6 @@
1
1
  describe("toBeNaN", function() {
2
2
  it("passes for NaN with a custom .not fail", function() {
3
- var matcher = j$.matchers.toBeNaN(),
3
+ var matcher = jasmineUnderTest.matchers.toBeNaN(),
4
4
  result;
5
5
 
6
6
  result = matcher.compare(Number.NaN);
@@ -9,7 +9,7 @@ describe("toBeNaN", function() {
9
9
  });
10
10
 
11
11
  it("fails for anything not a NaN", function() {
12
- var matcher = j$.matchers.toBeNaN(),
12
+ var matcher = jasmineUnderTest.matchers.toBeNaN(),
13
13
  result;
14
14
 
15
15
  result = matcher.compare(1);
@@ -29,7 +29,7 @@ describe("toBeNaN", function() {
29
29
  });
30
30
 
31
31
  it("has a custom message on failure", function() {
32
- var matcher = j$.matchers.toBeNaN(),
32
+ var matcher = jasmineUnderTest.matchers.toBeNaN(),
33
33
  result = matcher.compare(0);
34
34
 
35
35
  expect(result.message()).toEqual("Expected 0 to be NaN.");
@@ -1,6 +1,6 @@
1
1
  describe("toBeNull", function() {
2
2
  it("passes for null", function() {
3
- var matcher = j$.matchers.toBeNull(),
3
+ var matcher = jasmineUnderTest.matchers.toBeNull(),
4
4
  result;
5
5
 
6
6
  result = matcher.compare(null);
@@ -8,7 +8,7 @@ describe("toBeNull", function() {
8
8
  });
9
9
 
10
10
  it("fails for non-null", function() {
11
- var matcher = j$.matchers.toBeNull(),
11
+ var matcher = jasmineUnderTest.matchers.toBeNull(),
12
12
  result;
13
13
 
14
14
  result = matcher.compare('foo');
@@ -1,6 +1,6 @@
1
1
  describe("toBe", function() {
2
2
  it("passes when actual === expected", function() {
3
- var matcher = j$.matchers.toBe(),
3
+ var matcher = jasmineUnderTest.matchers.toBe(),
4
4
  result;
5
5
 
6
6
  result = matcher.compare(1, 1);
@@ -8,7 +8,7 @@ describe("toBe", function() {
8
8
  });
9
9
 
10
10
  it("fails when actual !== expected", function() {
11
- var matcher = j$.matchers.toBe(),
11
+ var matcher = jasmineUnderTest.matchers.toBe(),
12
12
  result;
13
13
 
14
14
  result = matcher.compare(1, 2);
@@ -1,6 +1,6 @@
1
1
  describe("toBeTruthy", function() {
2
2
  it("passes for 'truthy' values", function() {
3
- var matcher = j$.matchers.toBeTruthy(),
3
+ var matcher = jasmineUnderTest.matchers.toBeTruthy(),
4
4
  result;
5
5
 
6
6
  result = matcher.compare(true);
@@ -17,7 +17,7 @@ describe("toBeTruthy", function() {
17
17
  });
18
18
 
19
19
  it("fails for 'falsy' values", function() {
20
- var matcher = j$.matchers.toBeTruthy(),
20
+ var matcher = jasmineUnderTest.matchers.toBeTruthy(),
21
21
  result;
22
22
 
23
23
  result = matcher.compare(false);
@@ -1,6 +1,6 @@
1
1
  describe("toBeUndefined", function() {
2
2
  it("passes for undefined values", function() {
3
- var matcher = j$.matchers.toBeUndefined(),
3
+ var matcher = jasmineUnderTest.matchers.toBeUndefined(),
4
4
  result;
5
5
 
6
6
  result = matcher.compare(void 0);
@@ -9,7 +9,7 @@ describe("toBeUndefined", function() {
9
9
  });
10
10
 
11
11
  it("fails when matching defined values", function() {
12
- var matcher = j$.matchers.toBeUndefined(),
12
+ var matcher = jasmineUnderTest.matchers.toBeUndefined(),
13
13
  result;
14
14
 
15
15
  result = matcher.compare('foo');
@@ -1,9 +1,9 @@
1
1
  describe("toContain", function() {
2
- it("delegates to j$.matchersUtil.contains", function() {
2
+ it("delegates to jasmineUnderTest.matchersUtil.contains", function() {
3
3
  var util = {
4
4
  contains: jasmine.createSpy('delegated-contains').and.returnValue(true)
5
5
  },
6
- matcher = j$.matchers.toContain(util),
6
+ matcher = jasmineUnderTest.matchers.toContain(util),
7
7
  result;
8
8
 
9
9
  result = matcher.compare("ABC", "B");
@@ -11,12 +11,12 @@ describe("toContain", function() {
11
11
  expect(result.pass).toBe(true);
12
12
  });
13
13
 
14
- it("delegates to j$.matchersUtil.contains, passing in equality testers if present", function() {
14
+ it("delegates to jasmineUnderTest.matchersUtil.contains, passing in equality testers if present", function() {
15
15
  var util = {
16
16
  contains: jasmine.createSpy('delegated-contains').and.returnValue(true)
17
17
  },
18
18
  customEqualityTesters = ['a', 'b'],
19
- matcher = j$.matchers.toContain(util, customEqualityTesters),
19
+ matcher = jasmineUnderTest.matchers.toContain(util, customEqualityTesters),
20
20
  result;
21
21
 
22
22
  result = matcher.compare("ABC", "B");
@@ -3,7 +3,7 @@ describe("toEqual", function() {
3
3
  var util = {
4
4
  equals: jasmine.createSpy('delegated-equals').and.returnValue(true)
5
5
  },
6
- matcher = j$.matchers.toEqual(util),
6
+ matcher = jasmineUnderTest.matchers.toEqual(util),
7
7
  result;
8
8
 
9
9
  result = matcher.compare(1, 1);
@@ -17,7 +17,7 @@ describe("toEqual", function() {
17
17
  equals: jasmine.createSpy('delegated-equals').and.returnValue(true)
18
18
  },
19
19
  customEqualityTesters = ['a', 'b'],
20
- matcher = j$.matchers.toEqual(util, customEqualityTesters),
20
+ matcher = jasmineUnderTest.matchers.toEqual(util, customEqualityTesters),
21
21
  result;
22
22
 
23
23
  result = matcher.compare(1, 1);
@@ -1,7 +1,7 @@
1
1
  describe("toHaveBeenCalled", function() {
2
2
  it("passes when the actual was called, with a custom .not fail message", function() {
3
- var matcher = j$.matchers.toHaveBeenCalled(),
4
- calledSpy = j$.createSpy('called-spy'),
3
+ var matcher = jasmineUnderTest.matchers.toHaveBeenCalled(),
4
+ calledSpy = jasmineUnderTest.createSpy('called-spy'),
5
5
  result;
6
6
 
7
7
  calledSpy();
@@ -12,8 +12,8 @@ describe("toHaveBeenCalled", function() {
12
12
  });
13
13
 
14
14
  it("fails when the actual was not called", function() {
15
- var matcher = j$.matchers.toHaveBeenCalled(),
16
- uncalledSpy = j$.createSpy('uncalled spy'),
15
+ var matcher = jasmineUnderTest.matchers.toHaveBeenCalled(),
16
+ uncalledSpy = jasmineUnderTest.createSpy('uncalled spy'),
17
17
  result;
18
18
 
19
19
  result = matcher.compare(uncalledSpy);
@@ -21,22 +21,22 @@ describe("toHaveBeenCalled", function() {
21
21
  });
22
22
 
23
23
  it("throws an exception when the actual is not a spy", function() {
24
- var matcher = j$.matchers.toHaveBeenCalled(),
24
+ var matcher = jasmineUnderTest.matchers.toHaveBeenCalled(),
25
25
  fn = function() {};
26
26
 
27
- expect(function() { matcher.compare(fn) }).toThrow(new Error("Expected a spy, but got Function."));
27
+ expect(function() { matcher.compare(fn) }).toThrowError(Error, /Expected a spy, but got Function./);
28
28
  });
29
29
 
30
30
  it("throws an exception when invoked with any arguments", function() {
31
- var matcher = j$.matchers.toHaveBeenCalled(),
32
- spy = j$.createSpy('sample spy');
31
+ var matcher = jasmineUnderTest.matchers.toHaveBeenCalled(),
32
+ spy = jasmineUnderTest.createSpy('sample spy');
33
33
 
34
- expect(function() { matcher.compare(spy, 'foo') }).toThrow(new Error("toHaveBeenCalled does not take arguments, use toHaveBeenCalledWith"));
34
+ expect(function() { matcher.compare(spy, 'foo') }).toThrowError(Error, /Does not take arguments, use toHaveBeenCalledWith/);
35
35
  });
36
36
 
37
37
  it("has a custom message on failure", function() {
38
- var matcher = j$.matchers.toHaveBeenCalled(),
39
- spy = j$.createSpy('sample-spy'),
38
+ var matcher = jasmineUnderTest.matchers.toHaveBeenCalled(),
39
+ spy = jasmineUnderTest.createSpy('sample-spy'),
40
40
  result;
41
41
 
42
42
  result = matcher.compare(spy);
@@ -1,7 +1,14 @@
1
1
  describe("toHaveBeenCalledTimes", function() {
2
+ it("passes when the actual 0 matches the expected 0 ", function () {
3
+ var matcher = jasmineUnderTest.matchers.toHaveBeenCalledTimes(),
4
+ calledSpy = jasmineUnderTest.createSpy('called-spy'),
5
+ result;
6
+ result = matcher.compare(calledSpy, 0);
7
+ expect(result.pass).toBeTruthy();
8
+ });
2
9
  it("passes when the actual matches the expected", function() {
3
- var matcher = j$.matchers.toHaveBeenCalledTimes(),
4
- calledSpy = j$.createSpy('called-spy'),
10
+ var matcher = jasmineUnderTest.matchers.toHaveBeenCalledTimes(),
11
+ calledSpy = jasmineUnderTest.createSpy('called-spy'),
5
12
  result;
6
13
  calledSpy();
7
14
 
@@ -10,19 +17,19 @@ describe("toHaveBeenCalledTimes", function() {
10
17
  });
11
18
 
12
19
  it("fails when expected numbers is not supplied", function(){
13
- var matcher = j$.matchers.toHaveBeenCalledTimes(),
14
- spy = j$.createSpy('spy'),
20
+ var matcher = jasmineUnderTest.matchers.toHaveBeenCalledTimes(),
21
+ spy = jasmineUnderTest.createSpy('spy'),
15
22
  result;
16
23
 
17
24
  spy();
18
25
  expect(function() {
19
26
  matcher.compare(spy);
20
- }).toThrowError('Expected times failed is required as an argument.');
27
+ }).toThrowError(/The expected times failed is a required argument and must be a number./);
21
28
  });
22
29
 
23
30
  it("fails when the actual was called less than the expected", function() {
24
- var matcher = j$.matchers.toHaveBeenCalledTimes(),
25
- uncalledSpy = j$.createSpy('uncalled spy'),
31
+ var matcher = jasmineUnderTest.matchers.toHaveBeenCalledTimes(),
32
+ uncalledSpy = jasmineUnderTest.createSpy('uncalled spy'),
26
33
  result;
27
34
 
28
35
  result = matcher.compare(uncalledSpy, 2);
@@ -30,8 +37,8 @@ describe("toHaveBeenCalledTimes", function() {
30
37
  });
31
38
 
32
39
  it("fails when the actual was called more than expected", function() {
33
- var matcher = j$.matchers.toHaveBeenCalledTimes(),
34
- uncalledSpy = j$.createSpy('uncalled spy'),
40
+ var matcher = jasmineUnderTest.matchers.toHaveBeenCalledTimes(),
41
+ uncalledSpy = jasmineUnderTest.createSpy('uncalled spy'),
35
42
  result;
36
43
 
37
44
  uncalledSpy();
@@ -42,17 +49,17 @@ describe("toHaveBeenCalledTimes", function() {
42
49
  });
43
50
 
44
51
  it("throws an exception when the actual is not a spy", function() {
45
- var matcher = j$.matchers.toHaveBeenCalledTimes(),
52
+ var matcher = jasmineUnderTest.matchers.toHaveBeenCalledTimes(),
46
53
  fn = function() {};
47
54
 
48
55
  expect(function() {
49
56
  matcher.compare(fn);
50
- }).toThrowError("Expected a spy, but got Function.");
57
+ }).toThrowError(/Expected a spy, but got Function./);
51
58
  });
52
59
 
53
60
  it("has a custom message on failure that tells it was called only once", function() {
54
- var matcher = j$.matchers.toHaveBeenCalledTimes(),
55
- spy = j$.createSpy('sample-spy'),
61
+ var matcher = jasmineUnderTest.matchers.toHaveBeenCalledTimes(),
62
+ spy = jasmineUnderTest.createSpy('sample-spy'),
56
63
  result;
57
64
  spy();
58
65
  spy();
@@ -60,13 +67,12 @@ describe("toHaveBeenCalledTimes", function() {
60
67
  spy();
61
68
 
62
69
  result = matcher.compare(spy, 1);
63
-
64
70
  expect(result.message).toEqual('Expected spy sample-spy to have been called once. It was called ' + 4 + ' times.');
65
71
  });
66
72
 
67
73
  it("has a custom message on failure that tells how many times it was called", function() {
68
- var matcher = j$.matchers.toHaveBeenCalledTimes(),
69
- spy = j$.createSpy('sample-spy'),
74
+ var matcher = jasmineUnderTest.matchers.toHaveBeenCalledTimes(),
75
+ spy = jasmineUnderTest.createSpy('sample-spy'),
70
76
  result;
71
77
  spy();
72
78
  spy();
@@ -74,7 +80,6 @@ describe("toHaveBeenCalledTimes", function() {
74
80
  spy();
75
81
 
76
82
  result = matcher.compare(spy, 2);
77
-
78
83
  expect(result.message).toEqual('Expected spy sample-spy to have been called 2 times. It was called ' + 4 + ' times.');
79
84
  });
80
85
  });