evergreen 0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (110) hide show
  1. data/README.rdoc +4 -0
  2. data/bin/evergreen +18 -0
  3. data/lib/evergreen.rb +44 -0
  4. data/lib/evergreen/cli.rb +23 -0
  5. data/lib/evergreen/evergreen.js +3 -0
  6. data/lib/evergreen/runner.rb +56 -0
  7. data/lib/evergreen/server.rb +31 -0
  8. data/lib/evergreen/spec.rb +60 -0
  9. data/lib/evergreen/version.rb +3 -0
  10. data/lib/evergreen/views/list.erb +6 -0
  11. data/lib/evergreen/views/spec.erb +37 -0
  12. data/lib/jasmine/MIT.LICENSE +20 -0
  13. data/lib/jasmine/README.markdown +489 -0
  14. data/lib/jasmine/Rakefile +146 -0
  15. data/lib/jasmine/cruise_config.rb +21 -0
  16. data/lib/jasmine/doc/files.html +460 -0
  17. data/lib/jasmine/doc/index.html +322 -0
  18. data/lib/jasmine/doc/symbols/_global_.html +918 -0
  19. data/lib/jasmine/doc/symbols/jasmine.Block.html +417 -0
  20. data/lib/jasmine/doc/symbols/jasmine.Clock.html +678 -0
  21. data/lib/jasmine/doc/symbols/jasmine.Env.html +1169 -0
  22. data/lib/jasmine/doc/symbols/jasmine.JsApiReporter.html +822 -0
  23. data/lib/jasmine/doc/symbols/jasmine.Matchers.html +1474 -0
  24. data/lib/jasmine/doc/symbols/jasmine.MultiReporter.html +394 -0
  25. data/lib/jasmine/doc/symbols/jasmine.NestedResults.html +710 -0
  26. data/lib/jasmine/doc/symbols/jasmine.Reporter.html +574 -0
  27. data/lib/jasmine/doc/symbols/jasmine.Runner.html +710 -0
  28. data/lib/jasmine/doc/symbols/jasmine.Spec.html +1253 -0
  29. data/lib/jasmine/doc/symbols/jasmine.Spy.html +855 -0
  30. data/lib/jasmine/doc/symbols/jasmine.Suite.html +705 -0
  31. data/lib/jasmine/doc/symbols/jasmine.html +1345 -0
  32. data/lib/jasmine/doc/symbols/jasmine.util.html +535 -0
  33. data/lib/jasmine/doc/symbols/src/lib_TrivialReporter.js.html +124 -0
  34. data/lib/jasmine/doc/symbols/src/src_Block.js.html +29 -0
  35. data/lib/jasmine/doc/symbols/src/src_Env.js.html +248 -0
  36. data/lib/jasmine/doc/symbols/src/src_JsApiReporter.js.html +111 -0
  37. data/lib/jasmine/doc/symbols/src/src_Matchers.js.html +344 -0
  38. data/lib/jasmine/doc/symbols/src/src_MultiReporter.js.html +36 -0
  39. data/lib/jasmine/doc/symbols/src/src_NestedResults.js.html +88 -0
  40. data/lib/jasmine/doc/symbols/src/src_PrettyPrinter.js.html +130 -0
  41. data/lib/jasmine/doc/symbols/src/src_Queue.js.html +102 -0
  42. data/lib/jasmine/doc/symbols/src/src_Reporter.js.html +35 -0
  43. data/lib/jasmine/doc/symbols/src/src_Reporters.js.html +51 -0
  44. data/lib/jasmine/doc/symbols/src/src_Runner.js.html +75 -0
  45. data/lib/jasmine/doc/symbols/src/src_Spec.js.html +214 -0
  46. data/lib/jasmine/doc/symbols/src/src_Suite.js.html +77 -0
  47. data/lib/jasmine/doc/symbols/src/src_WaitsBlock.js.html +21 -0
  48. data/lib/jasmine/doc/symbols/src/src_WaitsForBlock.js.html +45 -0
  49. data/lib/jasmine/doc/symbols/src/src_base.js.html +585 -0
  50. data/lib/jasmine/doc/symbols/src/src_mock-timeout.js.html +185 -0
  51. data/lib/jasmine/doc/symbols/src/src_util.js.html +75 -0
  52. data/lib/jasmine/example/example_runner.html +22 -0
  53. data/lib/jasmine/example/spec/example_suite.js +11 -0
  54. data/lib/jasmine/images/fail-16.png +0 -0
  55. data/lib/jasmine/images/fail.png +0 -0
  56. data/lib/jasmine/images/go-16.png +0 -0
  57. data/lib/jasmine/images/go.png +0 -0
  58. data/lib/jasmine/images/pending-16.png +0 -0
  59. data/lib/jasmine/images/pending.png +0 -0
  60. data/lib/jasmine/images/question-bk.png +0 -0
  61. data/lib/jasmine/images/questionbk-16.png +0 -0
  62. data/lib/jasmine/images/spinner.gif +0 -0
  63. data/lib/jasmine/lib/TrivialReporter.js +171 -0
  64. data/lib/jasmine/lib/consolex.js +28 -0
  65. data/lib/jasmine/lib/jasmine-0.10.4.js +2371 -0
  66. data/lib/jasmine/lib/jasmine.css +166 -0
  67. data/lib/jasmine/lib/json2.js +478 -0
  68. data/lib/jasmine/spec/jasmine_helper.rb +44 -0
  69. data/lib/jasmine/spec/jasmine_spec.rb +31 -0
  70. data/lib/jasmine/spec/runner.html +80 -0
  71. data/lib/jasmine/spec/saucelabs.yml +24 -0
  72. data/lib/jasmine/spec/suites/CustomMatchersSpec.js +112 -0
  73. data/lib/jasmine/spec/suites/EnvSpec.js +158 -0
  74. data/lib/jasmine/spec/suites/ExceptionsSpec.js +107 -0
  75. data/lib/jasmine/spec/suites/JsApiReporterSpec.js +96 -0
  76. data/lib/jasmine/spec/suites/MatchersSpec.js +709 -0
  77. data/lib/jasmine/spec/suites/MockClockSpec.js +34 -0
  78. data/lib/jasmine/spec/suites/MultiReporterSpec.js +30 -0
  79. data/lib/jasmine/spec/suites/NestedResultsSpec.js +54 -0
  80. data/lib/jasmine/spec/suites/PrettyPrintSpec.js +93 -0
  81. data/lib/jasmine/spec/suites/QueueSpec.js +23 -0
  82. data/lib/jasmine/spec/suites/ReporterSpec.js +60 -0
  83. data/lib/jasmine/spec/suites/RunnerSpec.js +267 -0
  84. data/lib/jasmine/spec/suites/SpecRunningSpec.js +1195 -0
  85. data/lib/jasmine/spec/suites/SpecSpec.js +110 -0
  86. data/lib/jasmine/spec/suites/SpySpec.js +201 -0
  87. data/lib/jasmine/spec/suites/SuiteSpec.js +120 -0
  88. data/lib/jasmine/spec/suites/TrivialReporterSpec.js +158 -0
  89. data/lib/jasmine/spec/suites/UtilSpec.js +40 -0
  90. data/lib/jasmine/spec/suites/WaitsForBlockSpec.js +88 -0
  91. data/lib/jasmine/src/Block.js +22 -0
  92. data/lib/jasmine/src/Env.js +263 -0
  93. data/lib/jasmine/src/JsApiReporter.js +104 -0
  94. data/lib/jasmine/src/Matchers.js +336 -0
  95. data/lib/jasmine/src/MultiReporter.js +28 -0
  96. data/lib/jasmine/src/NestedResults.js +80 -0
  97. data/lib/jasmine/src/PrettyPrinter.js +122 -0
  98. data/lib/jasmine/src/Queue.js +94 -0
  99. data/lib/jasmine/src/Reporter.js +27 -0
  100. data/lib/jasmine/src/Reporters.js +43 -0
  101. data/lib/jasmine/src/Runner.js +77 -0
  102. data/lib/jasmine/src/Spec.js +206 -0
  103. data/lib/jasmine/src/Suite.js +82 -0
  104. data/lib/jasmine/src/WaitsBlock.js +13 -0
  105. data/lib/jasmine/src/WaitsForBlock.js +37 -0
  106. data/lib/jasmine/src/base.js +586 -0
  107. data/lib/jasmine/src/mock-timeout.js +177 -0
  108. data/lib/jasmine/src/util.js +67 -0
  109. data/lib/jasmine/src/version.json +5 -0
  110. metadata +238 -0
@@ -0,0 +1,94 @@
1
+ jasmine.Queue = function(env) {
2
+ this.env = env;
3
+ this.blocks = [];
4
+ this.running = false;
5
+ this.index = 0;
6
+ this.offset = 0;
7
+ };
8
+
9
+ jasmine.Queue.prototype.addBefore = function(block) {
10
+ this.blocks.unshift(block);
11
+ };
12
+
13
+ jasmine.Queue.prototype.add = function(block) {
14
+ this.blocks.push(block);
15
+ };
16
+
17
+ jasmine.Queue.prototype.insertNext = function(block) {
18
+ this.blocks.splice((this.index + this.offset + 1), 0, block);
19
+ this.offset++;
20
+ };
21
+
22
+ jasmine.Queue.prototype.start = function(onComplete) {
23
+ this.running = true;
24
+ this.onComplete = onComplete;
25
+ this.next_();
26
+ };
27
+
28
+ jasmine.Queue.prototype.isRunning = function() {
29
+ return this.running;
30
+ };
31
+
32
+ jasmine.Queue.LOOP_DONT_RECURSE = true;
33
+
34
+ jasmine.Queue.prototype.next_ = function() {
35
+ var self = this;
36
+ var goAgain = true;
37
+
38
+ while (goAgain) {
39
+ goAgain = false;
40
+
41
+ if (self.index < self.blocks.length) {
42
+ var calledSynchronously = true;
43
+ var completedSynchronously = false;
44
+
45
+ var onComplete = function () {
46
+ if (jasmine.Queue.LOOP_DONT_RECURSE && calledSynchronously) {
47
+ completedSynchronously = true;
48
+ return;
49
+ }
50
+
51
+ self.offset = 0;
52
+ self.index++;
53
+
54
+ var now = new Date().getTime();
55
+ if (self.env.updateInterval && now - self.env.lastUpdate > self.env.updateInterval) {
56
+ self.env.lastUpdate = now;
57
+ self.env.setTimeout(function() {
58
+ self.next_();
59
+ }, 0);
60
+ } else {
61
+ if (jasmine.Queue.LOOP_DONT_RECURSE && completedSynchronously) {
62
+ goAgain = true;
63
+ } else {
64
+ self.next_();
65
+ }
66
+ }
67
+ };
68
+ self.blocks[self.index].execute(onComplete);
69
+
70
+ calledSynchronously = false;
71
+ if (completedSynchronously) {
72
+ onComplete();
73
+ }
74
+
75
+ } else {
76
+ self.running = false;
77
+ if (self.onComplete) {
78
+ self.onComplete();
79
+ }
80
+ }
81
+ }
82
+ };
83
+
84
+ jasmine.Queue.prototype.results = function() {
85
+ var results = new jasmine.NestedResults();
86
+ for (var i = 0; i < this.blocks.length; i++) {
87
+ if (this.blocks[i].results) {
88
+ results.addResult(this.blocks[i].results());
89
+ }
90
+ }
91
+ return results;
92
+ };
93
+
94
+
@@ -0,0 +1,27 @@
1
+ /** No-op base class for Jasmine reporters.
2
+ *
3
+ * @constructor
4
+ */
5
+ jasmine.Reporter = function() {
6
+ };
7
+
8
+ //noinspection JSUnusedLocalSymbols
9
+ jasmine.Reporter.prototype.reportRunnerStarting = function(runner) {
10
+ };
11
+
12
+ //noinspection JSUnusedLocalSymbols
13
+ jasmine.Reporter.prototype.reportRunnerResults = function(runner) {
14
+ };
15
+
16
+ //noinspection JSUnusedLocalSymbols
17
+ jasmine.Reporter.prototype.reportSuiteResults = function(suite) {
18
+ };
19
+
20
+ //noinspection JSUnusedLocalSymbols
21
+ jasmine.Reporter.prototype.reportSpecResults = function(spec) {
22
+ };
23
+
24
+ //noinspection JSUnusedLocalSymbols
25
+ jasmine.Reporter.prototype.log = function(str) {
26
+ };
27
+
@@ -0,0 +1,43 @@
1
+ /** JasmineReporters.reporter
2
+ * Base object that will get called whenever a Spec, Suite, or Runner is done. It is up to
3
+ * descendants of this object to do something with the results (see json_reporter.js)
4
+ *
5
+ * @deprecated
6
+ */
7
+ jasmine.Reporters = {};
8
+
9
+ /**
10
+ * @deprecated
11
+ * @param callbacks
12
+ */
13
+ jasmine.Reporters.reporter = function(callbacks) {
14
+ /**
15
+ * @deprecated
16
+ * @param callbacks
17
+ */
18
+ var that = {
19
+ callbacks: callbacks || {},
20
+
21
+ doCallback: function(callback, results) {
22
+ if (callback) {
23
+ callback(results);
24
+ }
25
+ },
26
+
27
+ reportRunnerResults: function(runner) {
28
+ that.doCallback(that.callbacks.runnerCallback, runner);
29
+ },
30
+ reportSuiteResults: function(suite) {
31
+ that.doCallback(that.callbacks.suiteCallback, suite);
32
+ },
33
+ reportSpecResults: function(spec) {
34
+ that.doCallback(that.callbacks.specCallback, spec);
35
+ },
36
+ log: function (str) {
37
+ if (console && console.log) console.log(str);
38
+ }
39
+ };
40
+
41
+ return that;
42
+ };
43
+
@@ -0,0 +1,77 @@
1
+ /**
2
+ * Runner
3
+ *
4
+ * @constructor
5
+ * @param {jasmine.Env} env
6
+ */
7
+ jasmine.Runner = function(env) {
8
+ var self = this;
9
+ self.env = env;
10
+ self.queue = new jasmine.Queue(env);
11
+ self.before_ = [];
12
+ self.after_ = [];
13
+ self.suites_ = [];
14
+ };
15
+
16
+ jasmine.Runner.prototype.execute = function() {
17
+ var self = this;
18
+ if (self.env.reporter.reportRunnerStarting) {
19
+ self.env.reporter.reportRunnerStarting(this);
20
+ }
21
+ self.queue.start(function () {
22
+ self.finishCallback();
23
+ });
24
+ };
25
+
26
+ jasmine.Runner.prototype.beforeEach = function(beforeEachFunction) {
27
+ beforeEachFunction.typeName = 'beforeEach';
28
+ this.before_.splice(0,0,beforeEachFunction);
29
+ };
30
+
31
+ jasmine.Runner.prototype.afterEach = function(afterEachFunction) {
32
+ afterEachFunction.typeName = 'afterEach';
33
+ this.after_.splice(0,0,afterEachFunction);
34
+ };
35
+
36
+
37
+ jasmine.Runner.prototype.finishCallback = function() {
38
+ this.env.reporter.reportRunnerResults(this);
39
+ };
40
+
41
+ jasmine.Runner.prototype.addSuite = function(suite) {
42
+ this.suites_.push(suite);
43
+ };
44
+
45
+ jasmine.Runner.prototype.add = function(block) {
46
+ if (block instanceof jasmine.Suite) {
47
+ this.addSuite(block);
48
+ }
49
+ this.queue.add(block);
50
+ };
51
+
52
+ jasmine.Runner.prototype.specs = function () {
53
+ var suites = this.suites();
54
+ var specs = [];
55
+ for (var i = 0; i < suites.length; i++) {
56
+ specs = specs.concat(suites[i].specs());
57
+ }
58
+ return specs;
59
+ };
60
+
61
+ jasmine.Runner.prototype.suites = function() {
62
+ return this.suites_;
63
+ };
64
+
65
+ jasmine.Runner.prototype.topLevelSuites = function() {
66
+ var topLevelSuites = [];
67
+ for (var i = 0; i < this.suites_.length; i++) {
68
+ if (!this.suites_[i].parentSuite) {
69
+ topLevelSuites.push(this.suites_[i]);
70
+ }
71
+ }
72
+ return topLevelSuites;
73
+ };
74
+
75
+ jasmine.Runner.prototype.results = function() {
76
+ return this.queue.results();
77
+ };
@@ -0,0 +1,206 @@
1
+ /**
2
+ * Internal representation of a Jasmine specification, or test.
3
+ *
4
+ * @constructor
5
+ * @param {jasmine.Env} env
6
+ * @param {jasmine.Suite} suite
7
+ * @param {String} description
8
+ */
9
+ jasmine.Spec = function(env, suite, description) {
10
+ if (!env) {
11
+ throw new Error('jasmine.Env() required');
12
+ }
13
+ if (!suite) {
14
+ throw new Error('jasmine.Suite() required');
15
+ }
16
+ var spec = this;
17
+ spec.id = env.nextSpecId ? env.nextSpecId() : null;
18
+ spec.env = env;
19
+ spec.suite = suite;
20
+ spec.description = description;
21
+ spec.queue = new jasmine.Queue(env);
22
+
23
+ spec.afterCallbacks = [];
24
+ spec.spies_ = [];
25
+
26
+ spec.results_ = new jasmine.NestedResults();
27
+ spec.results_.description = description;
28
+ spec.matchersClass = null;
29
+ };
30
+
31
+ jasmine.Spec.prototype.getFullName = function() {
32
+ return this.suite.getFullName() + ' ' + this.description + '.';
33
+ };
34
+
35
+
36
+ jasmine.Spec.prototype.results = function() {
37
+ return this.results_;
38
+ };
39
+
40
+ jasmine.Spec.prototype.log = function(message) {
41
+ return this.results_.log(message);
42
+ };
43
+
44
+ /** @deprecated */
45
+ jasmine.Spec.prototype.getResults = function() {
46
+ return this.results_;
47
+ };
48
+
49
+ jasmine.Spec.prototype.runs = function (func) {
50
+ var block = new jasmine.Block(this.env, func, this);
51
+ this.addToQueue(block);
52
+ return this;
53
+ };
54
+
55
+ jasmine.Spec.prototype.addToQueue = function (block) {
56
+ if (this.queue.isRunning()) {
57
+ this.queue.insertNext(block);
58
+ } else {
59
+ this.queue.add(block);
60
+ }
61
+ };
62
+
63
+ jasmine.Spec.prototype.addMatcherResult = function(result) {
64
+ this.results_.addResult(result);
65
+ };
66
+
67
+ jasmine.Spec.prototype.expect = function(actual) {
68
+ var positive = new (this.getMatchersClass_())(this.env, actual, this);
69
+ positive.not = new (this.getMatchersClass_())(this.env, actual, this, true);
70
+ return positive;
71
+ };
72
+
73
+ jasmine.Spec.prototype.waits = function(timeout) {
74
+ var waitsFunc = new jasmine.WaitsBlock(this.env, timeout, this);
75
+ this.addToQueue(waitsFunc);
76
+ return this;
77
+ };
78
+
79
+ jasmine.Spec.prototype.waitsFor = function(timeout, latchFunction, timeoutMessage) {
80
+ var waitsForFunc = new jasmine.WaitsForBlock(this.env, timeout, latchFunction, timeoutMessage, this);
81
+ this.addToQueue(waitsForFunc);
82
+ return this;
83
+ };
84
+
85
+ jasmine.Spec.prototype.fail = function (e) {
86
+ var expectationResult = new jasmine.ExpectationResult({
87
+ passed: false,
88
+ message: e ? jasmine.util.formatException(e) : 'Exception'
89
+ });
90
+ this.results_.addResult(expectationResult);
91
+ };
92
+
93
+ jasmine.Spec.prototype.getMatchersClass_ = function() {
94
+ return this.matchersClass || this.env.matchersClass;
95
+ };
96
+
97
+ jasmine.Spec.prototype.addMatchers = function(matchersPrototype) {
98
+ var parent = this.getMatchersClass_();
99
+ var newMatchersClass = function() {
100
+ parent.apply(this, arguments);
101
+ };
102
+ jasmine.util.inherit(newMatchersClass, parent);
103
+ jasmine.Matchers.wrapInto_(matchersPrototype, newMatchersClass);
104
+ this.matchersClass = newMatchersClass;
105
+ };
106
+
107
+ jasmine.Spec.prototype.finishCallback = function() {
108
+ this.env.reporter.reportSpecResults(this);
109
+ };
110
+
111
+ jasmine.Spec.prototype.finish = function(onComplete) {
112
+ this.removeAllSpies();
113
+ this.finishCallback();
114
+ if (onComplete) {
115
+ onComplete();
116
+ }
117
+ };
118
+
119
+ jasmine.Spec.prototype.after = function(doAfter) {
120
+ if (this.queue.isRunning()) {
121
+ this.queue.add(new jasmine.Block(this.env, doAfter, this));
122
+ } else {
123
+ this.afterCallbacks.unshift(doAfter);
124
+ }
125
+ };
126
+
127
+ jasmine.Spec.prototype.execute = function(onComplete) {
128
+ var spec = this;
129
+ if (!spec.env.specFilter(spec)) {
130
+ spec.results_.skipped = true;
131
+ spec.finish(onComplete);
132
+ return;
133
+ }
134
+ this.env.reporter.log('>> Jasmine Running ' + this.suite.description + ' ' + this.description + '...');
135
+
136
+ spec.env.currentSpec = spec;
137
+
138
+ spec.addBeforesAndAftersToQueue();
139
+
140
+ spec.queue.start(function () {
141
+ spec.finish(onComplete);
142
+ });
143
+ };
144
+
145
+ jasmine.Spec.prototype.addBeforesAndAftersToQueue = function() {
146
+ var runner = this.env.currentRunner();
147
+ var i;
148
+
149
+ for (var suite = this.suite; suite; suite = suite.parentSuite) {
150
+ for (i = 0; i < suite.before_.length; i++) {
151
+ this.queue.addBefore(new jasmine.Block(this.env, suite.before_[i], this));
152
+ }
153
+ }
154
+ for (i = 0; i < runner.before_.length; i++) {
155
+ this.queue.addBefore(new jasmine.Block(this.env, runner.before_[i], this));
156
+ }
157
+ for (i = 0; i < this.afterCallbacks.length; i++) {
158
+ this.queue.add(new jasmine.Block(this.env, this.afterCallbacks[i], this));
159
+ }
160
+ for (suite = this.suite; suite; suite = suite.parentSuite) {
161
+ for (i = 0; i < suite.after_.length; i++) {
162
+ this.queue.add(new jasmine.Block(this.env, suite.after_[i], this));
163
+ }
164
+ }
165
+ for (i = 0; i < runner.after_.length; i++) {
166
+ this.queue.add(new jasmine.Block(this.env, runner.after_[i], this));
167
+ }
168
+ };
169
+
170
+ jasmine.Spec.prototype.explodes = function() {
171
+ throw 'explodes function should not have been called';
172
+ };
173
+
174
+ jasmine.Spec.prototype.spyOn = function(obj, methodName, ignoreMethodDoesntExist) {
175
+ if (obj == jasmine.undefined) {
176
+ throw "spyOn could not find an object to spy upon for " + methodName + "()";
177
+ }
178
+
179
+ if (!ignoreMethodDoesntExist && obj[methodName] === jasmine.undefined) {
180
+ throw methodName + '() method does not exist';
181
+ }
182
+
183
+ if (!ignoreMethodDoesntExist && obj[methodName] && obj[methodName].isSpy) {
184
+ throw new Error(methodName + ' has already been spied upon');
185
+ }
186
+
187
+ var spyObj = jasmine.createSpy(methodName);
188
+
189
+ this.spies_.push(spyObj);
190
+ spyObj.baseObj = obj;
191
+ spyObj.methodName = methodName;
192
+ spyObj.originalValue = obj[methodName];
193
+
194
+ obj[methodName] = spyObj;
195
+
196
+ return spyObj;
197
+ };
198
+
199
+ jasmine.Spec.prototype.removeAllSpies = function() {
200
+ for (var i = 0; i < this.spies_.length; i++) {
201
+ var spy = this.spies_[i];
202
+ spy.baseObj[spy.methodName] = spy.originalValue;
203
+ }
204
+ this.spies_ = [];
205
+ };
206
+