evergreen 0.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +101 -3
- data/bin/evergreen +2 -2
- data/lib/evergreen.rb +14 -2
- data/lib/evergreen/evergreen.js +23 -0
- data/lib/evergreen/rails.rb +8 -0
- data/lib/evergreen/runner.rb +21 -14
- data/lib/evergreen/spec.rb +12 -33
- data/lib/evergreen/version.rb +1 -1
- data/lib/evergreen/views/list.erb +1 -1
- data/lib/evergreen/views/spec.erb +9 -22
- data/lib/jasmine/README.markdown +21 -28
- data/lib/jasmine/Rakefile +98 -68
- data/lib/jasmine/example/SpecRunner.html +27 -0
- data/lib/jasmine/example/spec/PlayerSpec.js +58 -0
- data/lib/jasmine/example/spec/SpecHelper.js +9 -0
- data/lib/jasmine/example/src/Player.js +22 -0
- data/lib/jasmine/example/src/Song.js +7 -0
- data/lib/jasmine/lib/jasmine-html.js +182 -0
- data/lib/jasmine/lib/{jasmine-0.10.4.js → jasmine.js} +127 -155
- data/lib/jasmine/spec/runner.html +4 -3
- data/lib/jasmine/spec/suites/BaseSpec.js +27 -0
- data/lib/jasmine/spec/suites/CustomMatchersSpec.js +0 -24
- data/lib/jasmine/spec/suites/EnvSpec.js +1 -1
- data/lib/jasmine/spec/suites/JsApiReporterSpec.js +16 -9
- data/lib/jasmine/spec/suites/MatchersSpec.js +49 -42
- data/lib/jasmine/spec/suites/MockClockSpec.js +4 -0
- data/lib/jasmine/spec/suites/MultiReporterSpec.js +23 -8
- data/lib/jasmine/spec/suites/PrettyPrintSpec.js +2 -2
- data/lib/jasmine/spec/suites/ReporterSpec.js +10 -14
- data/lib/jasmine/spec/suites/RunnerSpec.js +6 -6
- data/lib/jasmine/spec/suites/SpecRunningSpec.js +1 -1
- data/lib/jasmine/spec/suites/SpecSpec.js +15 -1
- data/lib/jasmine/spec/suites/SpySpec.js +3 -3
- data/lib/jasmine/spec/suites/TrivialReporterSpec.js +91 -14
- data/lib/jasmine/spec/suites/WaitsForBlockSpec.js +5 -6
- data/lib/jasmine/src/JsApiReporter.js +4 -6
- data/lib/jasmine/src/Matchers.js +19 -19
- data/lib/jasmine/src/MultiReporter.js +8 -1
- data/lib/jasmine/src/NestedResults.js +5 -5
- data/lib/jasmine/src/PrettyPrinter.js +2 -2
- data/lib/jasmine/src/Reporter.js +4 -0
- data/lib/jasmine/src/Spec.js +12 -8
- data/lib/jasmine/src/base.js +40 -44
- data/lib/jasmine/{lib → src/html}/TrivialReporter.js +17 -6
- data/lib/jasmine/src/html/jasmine.css +166 -0
- data/lib/jasmine/src/mock-timeout.js +22 -16
- data/lib/jasmine/src/version.json +2 -2
- data/lib/tasks/evergreen.rake +7 -0
- data/spec/evergreen_spec.rb +18 -0
- data/spec/fixtures/public/jquery.js +152 -0
- data/spec/fixtures/spec/javascripts/bar_spec.js +0 -0
- data/spec/fixtures/spec/javascripts/failing_spec.js +12 -0
- data/spec/fixtures/spec/javascripts/foo_spec.js +0 -0
- data/spec/fixtures/spec/javascripts/templates_spec.html +1 -0
- data/spec/fixtures/spec/javascripts/templates_spec.js +23 -0
- data/spec/fixtures/spec/javascripts/testing_spec.js +11 -0
- data/spec/fixtures/spec/javascripts/transactions_spec.js +14 -0
- data/spec/meta_spec.rb +17 -0
- data/spec/runner_spec.rb +35 -0
- data/spec/spec_helper.rb +33 -0
- data/spec/spec_spec.rb +30 -0
- metadata +64 -48
- data/lib/jasmine/doc/files.html +0 -460
- data/lib/jasmine/doc/index.html +0 -322
- data/lib/jasmine/doc/symbols/_global_.html +0 -918
- data/lib/jasmine/doc/symbols/jasmine.Block.html +0 -417
- data/lib/jasmine/doc/symbols/jasmine.Clock.html +0 -678
- data/lib/jasmine/doc/symbols/jasmine.Env.html +0 -1169
- data/lib/jasmine/doc/symbols/jasmine.JsApiReporter.html +0 -822
- data/lib/jasmine/doc/symbols/jasmine.Matchers.html +0 -1474
- data/lib/jasmine/doc/symbols/jasmine.MultiReporter.html +0 -394
- data/lib/jasmine/doc/symbols/jasmine.NestedResults.html +0 -710
- data/lib/jasmine/doc/symbols/jasmine.Reporter.html +0 -574
- data/lib/jasmine/doc/symbols/jasmine.Runner.html +0 -710
- data/lib/jasmine/doc/symbols/jasmine.Spec.html +0 -1253
- data/lib/jasmine/doc/symbols/jasmine.Spy.html +0 -855
- data/lib/jasmine/doc/symbols/jasmine.Suite.html +0 -705
- data/lib/jasmine/doc/symbols/jasmine.html +0 -1345
- data/lib/jasmine/doc/symbols/jasmine.util.html +0 -535
- data/lib/jasmine/doc/symbols/src/lib_TrivialReporter.js.html +0 -124
- data/lib/jasmine/doc/symbols/src/src_Block.js.html +0 -29
- data/lib/jasmine/doc/symbols/src/src_Env.js.html +0 -248
- data/lib/jasmine/doc/symbols/src/src_JsApiReporter.js.html +0 -111
- data/lib/jasmine/doc/symbols/src/src_Matchers.js.html +0 -344
- data/lib/jasmine/doc/symbols/src/src_MultiReporter.js.html +0 -36
- data/lib/jasmine/doc/symbols/src/src_NestedResults.js.html +0 -88
- data/lib/jasmine/doc/symbols/src/src_PrettyPrinter.js.html +0 -130
- data/lib/jasmine/doc/symbols/src/src_Queue.js.html +0 -102
- data/lib/jasmine/doc/symbols/src/src_Reporter.js.html +0 -35
- data/lib/jasmine/doc/symbols/src/src_Reporters.js.html +0 -51
- data/lib/jasmine/doc/symbols/src/src_Runner.js.html +0 -75
- data/lib/jasmine/doc/symbols/src/src_Spec.js.html +0 -214
- data/lib/jasmine/doc/symbols/src/src_Suite.js.html +0 -77
- data/lib/jasmine/doc/symbols/src/src_WaitsBlock.js.html +0 -21
- data/lib/jasmine/doc/symbols/src/src_WaitsForBlock.js.html +0 -45
- data/lib/jasmine/doc/symbols/src/src_base.js.html +0 -585
- data/lib/jasmine/doc/symbols/src/src_mock-timeout.js.html +0 -185
- data/lib/jasmine/doc/symbols/src/src_util.js.html +0 -75
- data/lib/jasmine/example/example_runner.html +0 -22
- data/lib/jasmine/example/spec/example_suite.js +0 -11
- data/lib/jasmine/spec/jasmine_helper.rb +0 -44
- data/lib/jasmine/spec/jasmine_spec.rb +0 -31
- data/lib/jasmine/spec/saucelabs.yml +0 -24
- data/lib/jasmine/src/Reporters.js +0 -43
@@ -210,11 +210,11 @@ describe('RunnerTest', function() {
|
|
210
210
|
});
|
211
211
|
|
212
212
|
env.currentRunner().execute();
|
213
|
-
expect(fakeReporter.reportRunnerResults).
|
213
|
+
expect(fakeReporter.reportRunnerResults).not.toHaveBeenCalled();
|
214
214
|
fakeTimer.tick(200);
|
215
215
|
//This blows up the JSApiReporter.
|
216
|
-
//expect(fakeReporter.reportRunnerResults).
|
217
|
-
expect(fakeReporter.reportRunnerResults).
|
216
|
+
//expect(fakeReporter.reportRunnerResults).toHaveBeenCalledWith(env.currentRunner);
|
217
|
+
expect(fakeReporter.reportRunnerResults).toHaveBeenCalled();
|
218
218
|
expect(fakeReporter.reportRunnerResults.mostRecentCall.args[0].results()).toEqual(env.currentRunner().results());
|
219
219
|
});
|
220
220
|
});
|
@@ -227,12 +227,12 @@ describe('RunnerTest', function() {
|
|
227
227
|
var runner = new jasmine.Runner(env);
|
228
228
|
runner.arbitraryVariable = 'foo';
|
229
229
|
spyOn(runner.queue, 'start');
|
230
|
-
expect(fakeReporter.reportRunnerStarting).
|
230
|
+
expect(fakeReporter.reportRunnerStarting).not.toHaveBeenCalled();
|
231
231
|
runner.execute();
|
232
|
-
expect(fakeReporter.reportRunnerStarting).
|
232
|
+
expect(fakeReporter.reportRunnerStarting).toHaveBeenCalled();
|
233
233
|
var reportedRunner = fakeReporter.reportRunnerStarting.mostRecentCall.args[0];
|
234
234
|
expect(reportedRunner.arbitraryVariable).toEqual('foo');
|
235
|
-
expect(runner.queue.start).
|
235
|
+
expect(runner.queue.start).toHaveBeenCalled();
|
236
236
|
});
|
237
237
|
|
238
238
|
describe("when suites are nested", function() {
|
@@ -1118,7 +1118,7 @@ describe("jasmine spec running", function () {
|
|
1118
1118
|
|
1119
1119
|
disabledSuite.execute();
|
1120
1120
|
|
1121
|
-
expect(spy).
|
1121
|
+
expect(spy).not.toHaveBeenCalled();
|
1122
1122
|
});
|
1123
1123
|
|
1124
1124
|
it('#explodes should throw an exception when it is called inside a spec', function() {
|
@@ -34,7 +34,6 @@ describe('Spec', function () {
|
|
34
34
|
expect(spec2.id).toEqual(1);
|
35
35
|
expect(spec3.id).toEqual(2);
|
36
36
|
});
|
37
|
-
|
38
37
|
});
|
39
38
|
|
40
39
|
it('getFullName returns suite & spec description', function () {
|
@@ -106,5 +105,20 @@ describe('Spec', function () {
|
|
106
105
|
expect(results.passed()).toEqual(true);
|
107
106
|
});
|
108
107
|
});
|
108
|
+
|
109
|
+
it("includes log messages, which may contain arbitary objects", function() {
|
110
|
+
spec.runs(function() {
|
111
|
+
this.log("here's some log message", {key: 'value'}, 123);
|
112
|
+
});
|
113
|
+
spec.execute();
|
114
|
+
var items = results.getItems();
|
115
|
+
expect(items).toEqual([
|
116
|
+
jasmine.any(jasmine.ExpectationResult),
|
117
|
+
jasmine.any(jasmine.ExpectationResult),
|
118
|
+
jasmine.any(jasmine.MessageResult)
|
119
|
+
]);
|
120
|
+
var logResult = items[2];
|
121
|
+
expect(logResult.values).toEqual(["here's some log message", {key: 'value'}, 123]);
|
122
|
+
});
|
109
123
|
});
|
110
124
|
});
|
@@ -169,11 +169,11 @@ describe('Spies', function () {
|
|
169
169
|
var TestClass = { someFunction: function() {} };
|
170
170
|
this.spyOn(TestClass, 'someFunction');
|
171
171
|
|
172
|
-
expect(TestClass.someFunction).
|
172
|
+
expect(TestClass.someFunction).not.toHaveBeenCalled();
|
173
173
|
TestClass.someFunction();
|
174
|
-
expect(TestClass.someFunction).
|
174
|
+
expect(TestClass.someFunction).toHaveBeenCalled();
|
175
175
|
TestClass.someFunction.reset();
|
176
|
-
expect(TestClass.someFunction).
|
176
|
+
expect(TestClass.someFunction).not.toHaveBeenCalled();
|
177
177
|
expect(TestClass.someFunction.callCount).toEqual(0);
|
178
178
|
});
|
179
179
|
|
@@ -1,9 +1,16 @@
|
|
1
1
|
describe("TrivialReporter", function() {
|
2
|
+
var env;
|
2
3
|
var trivialReporter;
|
3
4
|
var body;
|
5
|
+
var fakeDocument;
|
4
6
|
|
5
7
|
beforeEach(function() {
|
8
|
+
env = new jasmine.Env();
|
9
|
+
env.updateInterval = 0;
|
10
|
+
|
6
11
|
body = document.createElement("body");
|
12
|
+
fakeDocument = { body: body, location: { search: "" } };
|
13
|
+
trivialReporter = new jasmine.TrivialReporter(fakeDocument);
|
7
14
|
});
|
8
15
|
|
9
16
|
function fakeSpec(name) {
|
@@ -29,16 +36,15 @@ describe("TrivialReporter", function() {
|
|
29
36
|
}
|
30
37
|
|
31
38
|
it("should run only specs beginning with spec parameter", function() {
|
32
|
-
|
39
|
+
fakeDocument.location.search = "?spec=run%20this";
|
33
40
|
expect(trivialReporter.specFilter(fakeSpec("run this"))).toBeTruthy();
|
34
41
|
expect(trivialReporter.specFilter(fakeSpec("not the right spec"))).toBeFalsy();
|
35
42
|
expect(trivialReporter.specFilter(fakeSpec("not run this"))).toBeFalsy();
|
36
43
|
});
|
37
44
|
|
38
45
|
it("should display empty divs for every suite when the runner is starting", function() {
|
39
|
-
var trivialReporter = new jasmine.TrivialReporter({ body: body });
|
40
46
|
trivialReporter.reportRunnerStarting({
|
41
|
-
env:
|
47
|
+
env: env,
|
42
48
|
suites: function() {
|
43
49
|
return [ new jasmine.Suite({}, "suite 1", null, null) ];
|
44
50
|
}
|
@@ -61,7 +67,6 @@ describe("TrivialReporter", function() {
|
|
61
67
|
|
62
68
|
var runner, spec, fakeTimer;
|
63
69
|
beforeEach(function () {
|
64
|
-
var env = new jasmine.Env();
|
65
70
|
fakeTimer = new jasmine.FakeTimer();
|
66
71
|
env.setTimeout = fakeTimer.setTimeout;
|
67
72
|
env.clearTimeout = fakeTimer.clearTimeout;
|
@@ -72,7 +77,7 @@ describe("TrivialReporter", function() {
|
|
72
77
|
runner.add(suite);
|
73
78
|
spec = new jasmine.Spec(env, suite, 'some spec');
|
74
79
|
suite.add(spec);
|
75
|
-
|
80
|
+
fakeDocument.location.search = "?";
|
76
81
|
env.addReporter(trivialReporter);
|
77
82
|
});
|
78
83
|
|
@@ -103,12 +108,10 @@ describe("TrivialReporter", function() {
|
|
103
108
|
getItems: function() {
|
104
109
|
}};
|
105
110
|
|
111
|
+
var suite1 = new jasmine.Suite(env, "suite 1", null, null);
|
112
|
+
|
106
113
|
spec = {
|
107
|
-
suite:
|
108
|
-
getFullName: function() {
|
109
|
-
return "suite 1";
|
110
|
-
}
|
111
|
-
},
|
114
|
+
suite: suite1,
|
112
115
|
getFullName: function() {
|
113
116
|
return "foo";
|
114
117
|
},
|
@@ -117,11 +120,10 @@ describe("TrivialReporter", function() {
|
|
117
120
|
}
|
118
121
|
};
|
119
122
|
|
120
|
-
trivialReporter = new jasmine.TrivialReporter({ body: body });
|
121
123
|
trivialReporter.reportRunnerStarting({
|
122
|
-
env:
|
124
|
+
env: env,
|
123
125
|
suites: function() {
|
124
|
-
return [
|
126
|
+
return [ suite1 ];
|
125
127
|
}
|
126
128
|
});
|
127
129
|
});
|
@@ -130,7 +132,7 @@ describe("TrivialReporter", function() {
|
|
130
132
|
expectationResult = new jasmine.ExpectationResult({
|
131
133
|
matcherName: "toBeNull", passed: false, message: "Expected 'a' to be null, but it was not"
|
132
134
|
});
|
133
|
-
|
135
|
+
|
134
136
|
spyOn(results, 'getItems').andReturn([expectationResult]);
|
135
137
|
|
136
138
|
trivialReporter.reportSpecResults(spec);
|
@@ -155,4 +157,79 @@ describe("TrivialReporter", function() {
|
|
155
157
|
});
|
156
158
|
});
|
157
159
|
|
160
|
+
describe("log messages", function() {
|
161
|
+
it("should appear in the report", function() {
|
162
|
+
env.describe("suite", function() {
|
163
|
+
env.it("will have log messages", function() {
|
164
|
+
this.log("this is a", "multipart log message");
|
165
|
+
});
|
166
|
+
});
|
167
|
+
|
168
|
+
env.addReporter(trivialReporter);
|
169
|
+
env.execute();
|
170
|
+
|
171
|
+
var divs = body.getElementsByTagName("div");
|
172
|
+
var errorDiv = findElement(divs, 'resultMessage log');
|
173
|
+
expect(errorDiv.innerHTML).toEqual("this is a multipart log message");
|
174
|
+
});
|
175
|
+
});
|
176
|
+
|
177
|
+
describe("duplicate example names", function() {
|
178
|
+
it("should report failures correctly", function() {
|
179
|
+
var suite1 = env.describe("suite", function() {
|
180
|
+
env.it("will have log messages", function() {
|
181
|
+
this.log("this one fails!");
|
182
|
+
this.expect(true).toBeFalsy();
|
183
|
+
});
|
184
|
+
});
|
185
|
+
|
186
|
+
var suite2 = env.describe("suite", function() {
|
187
|
+
env.it("will have log messages", function() {
|
188
|
+
this.log("this one passes!");
|
189
|
+
this.expect(true).toBeTruthy();
|
190
|
+
});
|
191
|
+
});
|
192
|
+
|
193
|
+
env.addReporter(trivialReporter);
|
194
|
+
env.execute();
|
195
|
+
|
196
|
+
var divs = body.getElementsByTagName("div");
|
197
|
+
var passedSpecDiv = findElement(divs, 'suite passed');
|
198
|
+
expect(passedSpecDiv.className).toEqual('suite passed');
|
199
|
+
expect(passedSpecDiv.innerHTML).toContain("this one passes!");
|
200
|
+
expect(passedSpecDiv.innerHTML).not.toContain("this one fails!");
|
201
|
+
|
202
|
+
var failedSpecDiv = findElement(divs, 'suite failed');
|
203
|
+
expect(failedSpecDiv.className).toEqual('suite failed');
|
204
|
+
expect(failedSpecDiv.innerHTML).toContain("this one fails!");
|
205
|
+
expect(failedSpecDiv.innerHTML).not.toContain("this one passes!");
|
206
|
+
});
|
207
|
+
});
|
208
|
+
|
209
|
+
describe('#reportSpecStarting', function() {
|
210
|
+
var spec1;
|
211
|
+
beforeEach(function () {
|
212
|
+
env.describe("suite 1", function() {
|
213
|
+
spec1 = env.it("spec 1", function() {
|
214
|
+
});
|
215
|
+
});
|
216
|
+
});
|
217
|
+
|
218
|
+
it('DOES NOT log running specs by default', function() {
|
219
|
+
spyOn(trivialReporter, 'log');
|
220
|
+
|
221
|
+
trivialReporter.reportSpecStarting(spec1);
|
222
|
+
|
223
|
+
expect(trivialReporter.log).not.toHaveBeenCalled();
|
224
|
+
});
|
225
|
+
|
226
|
+
it('logs running specs when log_running_specs is true', function() {
|
227
|
+
trivialReporter.logRunningSpecs = true;
|
228
|
+
spyOn(trivialReporter, 'log');
|
229
|
+
|
230
|
+
trivialReporter.reportSpecStarting(spec1);
|
231
|
+
|
232
|
+
expect(trivialReporter.log).toHaveBeenCalledWith('>> Jasmine Running suite 1 spec 1...');
|
233
|
+
});
|
234
|
+
});
|
158
235
|
});
|
@@ -17,7 +17,7 @@ describe('WaitsForBlock', function () {
|
|
17
17
|
var block = new jasmine.WaitsForBlock(env, timeout, latchFunction, message, spec);
|
18
18
|
expect(onComplete).wasNotCalled();
|
19
19
|
block.execute(onComplete);
|
20
|
-
expect(onComplete).
|
20
|
+
expect(onComplete).toHaveBeenCalled();
|
21
21
|
});
|
22
22
|
|
23
23
|
it('latchFunction should run in same scope as spec', function () {
|
@@ -36,8 +36,8 @@ describe('WaitsForBlock', function () {
|
|
36
36
|
spyOn(spec, 'fail');
|
37
37
|
var block = new jasmine.WaitsForBlock(env, timeout, latchFunction, message, spec);
|
38
38
|
block.execute(onComplete);
|
39
|
-
expect(spec.fail).
|
40
|
-
expect(onComplete).
|
39
|
+
expect(spec.fail).toHaveBeenCalledWith('some error');
|
40
|
+
expect(onComplete).toHaveBeenCalled();
|
41
41
|
});
|
42
42
|
|
43
43
|
describe("if latchFunction returns false", function() {
|
@@ -69,7 +69,7 @@ describe('WaitsForBlock', function () {
|
|
69
69
|
expect(onComplete).wasNotCalled();
|
70
70
|
latchFunction.andReturn(true);
|
71
71
|
fakeTimer.tick(100);
|
72
|
-
expect(onComplete).
|
72
|
+
expect(onComplete).toHaveBeenCalled();
|
73
73
|
});
|
74
74
|
|
75
75
|
it('spec should fail with the passed message if the timeout is reached (and not call onComplete)', function () {
|
@@ -78,11 +78,10 @@ describe('WaitsForBlock', function () {
|
|
78
78
|
block.execute(onComplete);
|
79
79
|
expect(spec.fail).wasNotCalled();
|
80
80
|
fakeTimer.tick(timeout);
|
81
|
-
expect(spec.fail).
|
81
|
+
expect(spec.fail).toHaveBeenCalled();
|
82
82
|
var failMessage = spec.fail.mostRecentCall.args[0].message;
|
83
83
|
expect(failMessage).toMatch(message);
|
84
84
|
expect(onComplete).wasNotCalled();
|
85
|
-
|
86
85
|
});
|
87
86
|
});
|
88
87
|
});
|
@@ -80,11 +80,11 @@ jasmine.JsApiReporter.prototype.resultsForSpecs = function(specIds){
|
|
80
80
|
|
81
81
|
jasmine.JsApiReporter.prototype.summarizeResult_ = function(result){
|
82
82
|
var summaryMessages = [];
|
83
|
-
var messagesLength = result.messages.length
|
83
|
+
var messagesLength = result.messages.length;
|
84
84
|
for (var messageIndex = 0; messageIndex < messagesLength; messageIndex++) {
|
85
85
|
var resultMessage = result.messages[messageIndex];
|
86
86
|
summaryMessages.push({
|
87
|
-
text: resultMessage.
|
87
|
+
text: resultMessage.type == 'log' ? resultMessage.toString() : jasmine.undefined,
|
88
88
|
passed: resultMessage.passed ? resultMessage.passed() : true,
|
89
89
|
type: resultMessage.type,
|
90
90
|
message: resultMessage.message,
|
@@ -92,13 +92,11 @@ jasmine.JsApiReporter.prototype.summarizeResult_ = function(result){
|
|
92
92
|
stack: resultMessage.passed && !resultMessage.passed() ? resultMessage.trace.stack : jasmine.undefined
|
93
93
|
}
|
94
94
|
});
|
95
|
-
}
|
95
|
+
}
|
96
96
|
|
97
|
-
|
97
|
+
return {
|
98
98
|
result : result.result,
|
99
99
|
messages : summaryMessages
|
100
100
|
};
|
101
|
-
|
102
|
-
return summaryResult;
|
103
101
|
};
|
104
102
|
|
data/lib/jasmine/src/Matchers.js
CHANGED
@@ -15,25 +15,11 @@ jasmine.Matchers = function(env, actual, spec, opt_isNot) {
|
|
15
15
|
// todo: @deprecated as of Jasmine 0.11, remove soon [xw]
|
16
16
|
jasmine.Matchers.pp = function(str) {
|
17
17
|
throw new Error("jasmine.Matchers.pp() is no longer supported, please use jasmine.pp() instead!");
|
18
|
-
this.report();
|
19
18
|
};
|
20
19
|
|
21
|
-
|
20
|
+
// todo: @deprecated Deprecated as of Jasmine 0.10. Rewrite your custom matchers to return true or false. [xw]
|
22
21
|
jasmine.Matchers.prototype.report = function(result, failing_message, details) {
|
23
|
-
|
24
|
-
|
25
|
-
if (this.isNot) {
|
26
|
-
throw new Error("As of jasmine 0.11, custom matchers must be implemented differently -- please see jasmine docs");
|
27
|
-
}
|
28
|
-
|
29
|
-
this.reportWasCalled_ = true;
|
30
|
-
var expectationResult = new jasmine.ExpectationResult({
|
31
|
-
passed: result,
|
32
|
-
message: failing_message,
|
33
|
-
details: details
|
34
|
-
});
|
35
|
-
this.spec.addMatcherResult(expectationResult);
|
36
|
-
return result;
|
22
|
+
throw new Error("As of jasmine 0.11, custom matchers must be implemented differently -- please see jasmine docs");
|
37
23
|
};
|
38
24
|
|
39
25
|
jasmine.Matchers.wrapInto_ = function(prototype, matchersClass) {
|
@@ -176,12 +162,18 @@ jasmine.Matchers.prototype.toBeFalsy = function() {
|
|
176
162
|
return !this.actual;
|
177
163
|
};
|
178
164
|
|
165
|
+
|
166
|
+
/** @deprecated Use expect(xxx).toHaveBeenCalled() instead */
|
167
|
+
jasmine.Matchers.prototype.wasCalled = function() {
|
168
|
+
return this.toHaveBeenCalled();
|
169
|
+
};
|
170
|
+
|
179
171
|
/**
|
180
172
|
* Matcher that checks to see if the actual, a Jasmine spy, was called.
|
181
173
|
*/
|
182
|
-
jasmine.Matchers.prototype.
|
174
|
+
jasmine.Matchers.prototype.toHaveBeenCalled = function() {
|
183
175
|
if (arguments.length > 0) {
|
184
|
-
throw new Error('
|
176
|
+
throw new Error('toHaveBeenCalled does not take arguments, use toHaveBeenCalledWith');
|
185
177
|
}
|
186
178
|
|
187
179
|
if (!jasmine.isSpy(this.actual)) {
|
@@ -197,6 +189,8 @@ jasmine.Matchers.prototype.wasCalled = function() {
|
|
197
189
|
|
198
190
|
/**
|
199
191
|
* Matcher that checks to see if the actual, a Jasmine spy, was not called.
|
192
|
+
*
|
193
|
+
* @deprecated Use expect(xxx).not.toHaveBeenCalled() instead
|
200
194
|
*/
|
201
195
|
jasmine.Matchers.prototype.wasNotCalled = function() {
|
202
196
|
if (arguments.length > 0) {
|
@@ -214,13 +208,18 @@ jasmine.Matchers.prototype.wasNotCalled = function() {
|
|
214
208
|
return !this.actual.wasCalled;
|
215
209
|
};
|
216
210
|
|
211
|
+
/** @deprecated Use expect(xxx).toHaveBeenCalledWith() instead */
|
212
|
+
jasmine.Matchers.prototype.wasCalledWith = function() {
|
213
|
+
return this.toHaveBeenCalledWith.apply(this, arguments);
|
214
|
+
};
|
215
|
+
|
217
216
|
/**
|
218
217
|
* Matcher that checks to see if the actual, a Jasmine spy, was called with a set of parameters.
|
219
218
|
*
|
220
219
|
* @example
|
221
220
|
*
|
222
221
|
*/
|
223
|
-
jasmine.Matchers.prototype.
|
222
|
+
jasmine.Matchers.prototype.toHaveBeenCalledWith = function() {
|
224
223
|
var expectedArgs = jasmine.util.argsToArray(arguments);
|
225
224
|
if (!jasmine.isSpy(this.actual)) {
|
226
225
|
throw new Error('Expected a spy, but got ' + jasmine.pp(this.actual) + '.');
|
@@ -236,6 +235,7 @@ jasmine.Matchers.prototype.wasCalledWith = function() {
|
|
236
235
|
return this.env.contains_(this.actual.argsForCall, expectedArgs);
|
237
236
|
};
|
238
237
|
|
238
|
+
/** @deprecated Use expect(xxx).not.toHaveBeenCalledWith() instead */
|
239
239
|
jasmine.Matchers.prototype.wasNotCalledWith = function() {
|
240
240
|
var expectedArgs = jasmine.util.argsToArray(arguments);
|
241
241
|
if (!jasmine.isSpy(this.actual)) {
|
@@ -11,7 +11,14 @@ jasmine.MultiReporter.prototype.addReporter = function(reporter) {
|
|
11
11
|
};
|
12
12
|
|
13
13
|
(function() {
|
14
|
-
var functionNames = [
|
14
|
+
var functionNames = [
|
15
|
+
"reportRunnerStarting",
|
16
|
+
"reportRunnerResults",
|
17
|
+
"reportSuiteResults",
|
18
|
+
"reportSpecStarting",
|
19
|
+
"reportSpecResults",
|
20
|
+
"log"
|
21
|
+
];
|
15
22
|
for (var i = 0; i < functionNames.length; i++) {
|
16
23
|
var functionName = functionNames[i];
|
17
24
|
jasmine.MultiReporter.prototype[functionName] = (function(functionName) {
|
@@ -38,11 +38,11 @@ jasmine.NestedResults.prototype.rollupCounts = function(result) {
|
|
38
38
|
};
|
39
39
|
|
40
40
|
/**
|
41
|
-
*
|
42
|
-
* @param message
|
41
|
+
* Adds a log message.
|
42
|
+
* @param values Array of message parts which will be concatenated later.
|
43
43
|
*/
|
44
|
-
jasmine.NestedResults.prototype.log = function(
|
45
|
-
this.items_.push(new jasmine.MessageResult(
|
44
|
+
jasmine.NestedResults.prototype.log = function(values) {
|
45
|
+
this.items_.push(new jasmine.MessageResult(values));
|
46
46
|
};
|
47
47
|
|
48
48
|
/**
|
@@ -57,7 +57,7 @@ jasmine.NestedResults.prototype.getItems = function() {
|
|
57
57
|
* @param {jasmine.ExpectationResult|jasmine.NestedResults} result
|
58
58
|
*/
|
59
59
|
jasmine.NestedResults.prototype.addResult = function(result) {
|
60
|
-
if (result.type != '
|
60
|
+
if (result.type != 'log') {
|
61
61
|
if (result.items_) {
|
62
62
|
this.rollupCounts(result);
|
63
63
|
} else {
|