jasmine 1.0.2.1 → 1.1.0.rc2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (99) hide show
  1. data/.gitignore +1 -0
  2. data/Gemfile +0 -3
  3. data/README.markdown +7 -1
  4. data/Rakefile +10 -24
  5. data/generators/jasmine/templates/jasmine-example/SpecRunner.html +40 -13
  6. data/generators/jasmine/templates/jasmine-example/spec/SpecHelper.js +3 -3
  7. data/jasmine.gemspec +18 -8
  8. data/lib/generators/jasmine/templates/lib/tasks/jasmine.rake +8 -2
  9. data/lib/jasmine/base.rb +9 -6
  10. data/lib/jasmine/command_line_tool.rb +1 -1
  11. data/lib/jasmine/firebug/firebug-1.6.2.xpi +0 -0
  12. data/lib/jasmine/firebug/firebug-1.7.0.xpi +0 -0
  13. data/lib/jasmine/firebug/firebug-license.txt +30 -0
  14. data/lib/jasmine/firebug/firebug.rb +30 -0
  15. data/lib/jasmine/selenium_driver.rb +8 -2
  16. data/lib/jasmine/server.rb +4 -7
  17. data/lib/jasmine/tasks/jasmine.rake +15 -6
  18. data/lib/jasmine/version.rb +1 -1
  19. data/spec/fixture/Rakefile +4 -0
  20. data/spec/fixture/spec/example_spec.js +5 -0
  21. data/spec/fixture/src/example.js +3 -0
  22. data/spec/jasmine_command_line_tool_rakeless_spec.rb +20 -0
  23. data/spec/jasmine_rails2_spec.rb +1 -1
  24. data/spec/jasmine_self_test_config.rb +6 -2
  25. data/spec/jasmine_self_test_spec.rb +0 -1
  26. data/spec/server_spec.rb +12 -11
  27. metadata +39 -92
  28. data/.gitmodules +0 -3
  29. data/jasmine/Gemfile +0 -6
  30. data/jasmine/HowToRelease.markdown +0 -29
  31. data/jasmine/MIT.LICENSE +0 -20
  32. data/jasmine/README.markdown +0 -50
  33. data/jasmine/Rakefile +0 -166
  34. data/jasmine/cruise_config.rb +0 -21
  35. data/jasmine/example/SpecRunner.html +0 -27
  36. data/jasmine/example/spec/PlayerSpec.js +0 -58
  37. data/jasmine/example/spec/SpecHelper.js +0 -9
  38. data/jasmine/example/src/Player.js +0 -22
  39. data/jasmine/example/src/Song.js +0 -7
  40. data/jasmine/images/jasmine_favicon.png +0 -0
  41. data/jasmine/jsdoc-template/allclasses.tmpl +0 -17
  42. data/jasmine/jsdoc-template/allfiles.tmpl +0 -56
  43. data/jasmine/jsdoc-template/class.tmpl +0 -646
  44. data/jasmine/jsdoc-template/index.tmpl +0 -39
  45. data/jasmine/jsdoc-template/publish.js +0 -184
  46. data/jasmine/jsdoc-template/static/default.css +0 -162
  47. data/jasmine/jsdoc-template/static/header.html +0 -2
  48. data/jasmine/jsdoc-template/static/index.html +0 -19
  49. data/jasmine/jsdoc-template/symbol.tmpl +0 -35
  50. data/jasmine/jshint/jshint.js +0 -5919
  51. data/jasmine/jshint/run.js +0 -98
  52. data/jasmine/lib/jasmine-html.js +0 -190
  53. data/jasmine/lib/jasmine.css +0 -166
  54. data/jasmine/lib/jasmine.js +0 -2445
  55. data/jasmine/lib/json2.js +0 -478
  56. data/jasmine/spec/node_suite.js +0 -233
  57. data/jasmine/spec/runner.html +0 -82
  58. data/jasmine/spec/suites/BaseSpec.js +0 -27
  59. data/jasmine/spec/suites/CustomMatchersSpec.js +0 -97
  60. data/jasmine/spec/suites/EnvSpec.js +0 -158
  61. data/jasmine/spec/suites/ExceptionsSpec.js +0 -107
  62. data/jasmine/spec/suites/JsApiReporterSpec.js +0 -103
  63. data/jasmine/spec/suites/MatchersSpec.js +0 -795
  64. data/jasmine/spec/suites/MockClockSpec.js +0 -38
  65. data/jasmine/spec/suites/MultiReporterSpec.js +0 -45
  66. data/jasmine/spec/suites/NestedResultsSpec.js +0 -54
  67. data/jasmine/spec/suites/PrettyPrintSpec.js +0 -93
  68. data/jasmine/spec/suites/QueueSpec.js +0 -23
  69. data/jasmine/spec/suites/ReporterSpec.js +0 -56
  70. data/jasmine/spec/suites/RunnerSpec.js +0 -267
  71. data/jasmine/spec/suites/SpecRunningSpec.js +0 -1253
  72. data/jasmine/spec/suites/SpecSpec.js +0 -124
  73. data/jasmine/spec/suites/SpySpec.js +0 -201
  74. data/jasmine/spec/suites/SuiteSpec.js +0 -120
  75. data/jasmine/spec/suites/TrivialConsoleReporterSpec.js +0 -431
  76. data/jasmine/spec/suites/TrivialReporterSpec.js +0 -238
  77. data/jasmine/spec/suites/UtilSpec.js +0 -39
  78. data/jasmine/spec/suites/WaitsForBlockSpec.js +0 -118
  79. data/jasmine/src/Block.js +0 -22
  80. data/jasmine/src/Env.js +0 -264
  81. data/jasmine/src/JsApiReporter.js +0 -102
  82. data/jasmine/src/Matchers.js +0 -354
  83. data/jasmine/src/MultiReporter.js +0 -35
  84. data/jasmine/src/NestedResults.js +0 -80
  85. data/jasmine/src/PrettyPrinter.js +0 -123
  86. data/jasmine/src/Queue.js +0 -99
  87. data/jasmine/src/Reporter.js +0 -31
  88. data/jasmine/src/Runner.js +0 -77
  89. data/jasmine/src/Spec.js +0 -242
  90. data/jasmine/src/Suite.js +0 -82
  91. data/jasmine/src/WaitsBlock.js +0 -15
  92. data/jasmine/src/WaitsForBlock.js +0 -54
  93. data/jasmine/src/base.js +0 -608
  94. data/jasmine/src/console/TrivialConsoleReporter.js +0 -144
  95. data/jasmine/src/html/TrivialReporter.js +0 -190
  96. data/jasmine/src/html/jasmine.css +0 -166
  97. data/jasmine/src/mock-timeout.js +0 -183
  98. data/jasmine/src/util.js +0 -67
  99. data/jasmine/src/version.json +0 -5
@@ -1,98 +0,0 @@
1
- var fs = require("fs");
2
- var sys = require("sys");
3
- var path = require("path");
4
- var JSHINT = require("./jshint").JSHINT;
5
-
6
- function isExcluded(fullPath) {
7
- var fileName = path.basename(fullPath);
8
- var excludeFiles = ["json2.js", "jshint.js", "publish.js", "node_suite.js", "jasmine.js", "jasmine-html.js"];
9
- for (var i = 0; i < excludeFiles.length; i++) {
10
- if (fileName == excludeFiles[i]) {
11
- return true;
12
- }
13
- }
14
- return false;
15
- }
16
-
17
- // DWF TODO: This function could/should be re-written
18
- function allJasmineJsFiles(rootDir) {
19
- var files = [];
20
- fs.readdirSync(rootDir).filter(function(filename) {
21
-
22
- var fullPath = rootDir + "/" + filename;
23
- if (fs.statSync(fullPath).isDirectory() && !fullPath.match(/pages/)) {
24
- var subDirFiles = allJasmineJsFiles(fullPath);
25
- if (subDirFiles.length > 0) {
26
- files = files.concat();
27
- return true;
28
- }
29
- } else {
30
- if (fullPath.match(/\.js$/) && !isExcluded(fullPath)) {
31
- files.push(fullPath);
32
- return true;
33
- }
34
- }
35
- return false;
36
- });
37
-
38
- return files;
39
- }
40
-
41
- var jasmineJsFiles = allJasmineJsFiles(".");
42
- jasmineJsFiles.reverse(); //cheap way to do the stuff in src stuff first
43
-
44
- var jasmineJsHintConfig = {
45
-
46
- forin:true, //while it's possible that we could be
47
- //considering unwanted prototype methods, mostly
48
- //we're doing this because the jsobjects are being
49
- //used as maps.
50
-
51
- loopfunc:true //we're fine with functions defined inside loops (setTimeout functions, etc)
52
-
53
- };
54
-
55
- var jasmineGlobals = {};
56
-
57
-
58
- //jasmine.undefined is a jasmine-ism, let's let it go...
59
- function removeJasmineUndefinedErrors(errors) {
60
- var keepErrors = [];
61
- for (var i = 0; i < errors.length; i++) {
62
- if (!(errors[i] &&
63
- errors[i].raw &&
64
- errors[i].evidence &&
65
- ( errors[i].evidence.match(/jasmine\.undefined/) ||
66
- errors[i].evidence.match(/diz be undefined yo/) )
67
- )) {
68
- keepErrors.push(errors[i]);
69
- }
70
- }
71
- return keepErrors;
72
- }
73
-
74
- (function() {
75
- var ansi = {
76
- green: '\033[32m',
77
- red: '\033[31m',
78
- yellow: '\033[33m',
79
- none: '\033[0m'
80
- };
81
-
82
- for (var i = 0; i < jasmineJsFiles.length; i++) {
83
- var file = jasmineJsFiles[i];
84
- JSHINT(fs.readFileSync(file, "utf8"), jasmineJsHintConfig);
85
- var errors = JSHINT.data().errors || [];
86
- errors = removeJasmineUndefinedErrors(errors);
87
-
88
- if (errors.length >= 1) {
89
- console.log(ansi.red + "Jasmine JSHint failure: " + ansi.none);
90
- console.log(file);
91
- console.log(errors);
92
- process.exit(1);
93
- }
94
- }
95
-
96
- console.log(ansi.green + "Jasmine JSHint PASSED." + ansi.none);
97
- })();
98
-
@@ -1,190 +0,0 @@
1
- jasmine.TrivialReporter = function(doc) {
2
- this.document = doc || document;
3
- this.suiteDivs = {};
4
- this.logRunningSpecs = false;
5
- };
6
-
7
- jasmine.TrivialReporter.prototype.createDom = function(type, attrs, childrenVarArgs) {
8
- var el = document.createElement(type);
9
-
10
- for (var i = 2; i < arguments.length; i++) {
11
- var child = arguments[i];
12
-
13
- if (typeof child === 'string') {
14
- el.appendChild(document.createTextNode(child));
15
- } else {
16
- if (child) { el.appendChild(child); }
17
- }
18
- }
19
-
20
- for (var attr in attrs) {
21
- if (attr == "className") {
22
- el[attr] = attrs[attr];
23
- } else {
24
- el.setAttribute(attr, attrs[attr]);
25
- }
26
- }
27
-
28
- return el;
29
- };
30
-
31
- jasmine.TrivialReporter.prototype.reportRunnerStarting = function(runner) {
32
- var showPassed, showSkipped;
33
-
34
- this.outerDiv = this.createDom('div', { className: 'jasmine_reporter' },
35
- this.createDom('div', { className: 'banner' },
36
- this.createDom('div', { className: 'logo' },
37
- this.createDom('a', { href: 'http://pivotal.github.com/jasmine/', target: "_blank" }, "Jasmine"),
38
- this.createDom('span', { className: 'version' }, runner.env.versionString())),
39
- this.createDom('div', { className: 'options' },
40
- "Show ",
41
- showPassed = this.createDom('input', { id: "__jasmine_TrivialReporter_showPassed__", type: 'checkbox' }),
42
- this.createDom('label', { "for": "__jasmine_TrivialReporter_showPassed__" }, " passed "),
43
- showSkipped = this.createDom('input', { id: "__jasmine_TrivialReporter_showSkipped__", type: 'checkbox' }),
44
- this.createDom('label', { "for": "__jasmine_TrivialReporter_showSkipped__" }, " skipped")
45
- )
46
- ),
47
-
48
- this.runnerDiv = this.createDom('div', { className: 'runner running' },
49
- this.createDom('a', { className: 'run_spec', href: '?' }, "run all"),
50
- this.runnerMessageSpan = this.createDom('span', {}, "Running..."),
51
- this.finishedAtSpan = this.createDom('span', { className: 'finished-at' }, ""))
52
- );
53
-
54
- this.document.body.appendChild(this.outerDiv);
55
-
56
- var suites = runner.suites();
57
- for (var i = 0; i < suites.length; i++) {
58
- var suite = suites[i];
59
- var suiteDiv = this.createDom('div', { className: 'suite' },
60
- this.createDom('a', { className: 'run_spec', href: '?spec=' + encodeURIComponent(suite.getFullName()) }, "run"),
61
- this.createDom('a', { className: 'description', href: '?spec=' + encodeURIComponent(suite.getFullName()) }, suite.description));
62
- this.suiteDivs[suite.id] = suiteDiv;
63
- var parentDiv = this.outerDiv;
64
- if (suite.parentSuite) {
65
- parentDiv = this.suiteDivs[suite.parentSuite.id];
66
- }
67
- parentDiv.appendChild(suiteDiv);
68
- }
69
-
70
- this.startedAt = new Date();
71
-
72
- var self = this;
73
- showPassed.onclick = function(evt) {
74
- if (showPassed.checked) {
75
- self.outerDiv.className += ' show-passed';
76
- } else {
77
- self.outerDiv.className = self.outerDiv.className.replace(/ show-passed/, '');
78
- }
79
- };
80
-
81
- showSkipped.onclick = function(evt) {
82
- if (showSkipped.checked) {
83
- self.outerDiv.className += ' show-skipped';
84
- } else {
85
- self.outerDiv.className = self.outerDiv.className.replace(/ show-skipped/, '');
86
- }
87
- };
88
- };
89
-
90
- jasmine.TrivialReporter.prototype.reportRunnerResults = function(runner) {
91
- var results = runner.results();
92
- var className = (results.failedCount > 0) ? "runner failed" : "runner passed";
93
- this.runnerDiv.setAttribute("class", className);
94
- //do it twice for IE
95
- this.runnerDiv.setAttribute("className", className);
96
- var specs = runner.specs();
97
- var specCount = 0;
98
- for (var i = 0; i < specs.length; i++) {
99
- if (this.specFilter(specs[i])) {
100
- specCount++;
101
- }
102
- }
103
- var message = "" + specCount + " spec" + (specCount == 1 ? "" : "s" ) + ", " + results.failedCount + " failure" + ((results.failedCount == 1) ? "" : "s");
104
- message += " in " + ((new Date().getTime() - this.startedAt.getTime()) / 1000) + "s";
105
- this.runnerMessageSpan.replaceChild(this.createDom('a', { className: 'description', href: '?'}, message), this.runnerMessageSpan.firstChild);
106
-
107
- this.finishedAtSpan.appendChild(document.createTextNode("Finished at " + new Date().toString()));
108
- };
109
-
110
- jasmine.TrivialReporter.prototype.reportSuiteResults = function(suite) {
111
- var results = suite.results();
112
- var status = results.passed() ? 'passed' : 'failed';
113
- if (results.totalCount === 0) { // todo: change this to check results.skipped
114
- status = 'skipped';
115
- }
116
- this.suiteDivs[suite.id].className += " " + status;
117
- };
118
-
119
- jasmine.TrivialReporter.prototype.reportSpecStarting = function(spec) {
120
- if (this.logRunningSpecs) {
121
- this.log('>> Jasmine Running ' + spec.suite.description + ' ' + spec.description + '...');
122
- }
123
- };
124
-
125
- jasmine.TrivialReporter.prototype.reportSpecResults = function(spec) {
126
- var results = spec.results();
127
- var status = results.passed() ? 'passed' : 'failed';
128
- if (results.skipped) {
129
- status = 'skipped';
130
- }
131
- var specDiv = this.createDom('div', { className: 'spec ' + status },
132
- this.createDom('a', { className: 'run_spec', href: '?spec=' + encodeURIComponent(spec.getFullName()) }, "run"),
133
- this.createDom('a', {
134
- className: 'description',
135
- href: '?spec=' + encodeURIComponent(spec.getFullName()),
136
- title: spec.getFullName()
137
- }, spec.description));
138
-
139
-
140
- var resultItems = results.getItems();
141
- var messagesDiv = this.createDom('div', { className: 'messages' });
142
- for (var i = 0; i < resultItems.length; i++) {
143
- var result = resultItems[i];
144
-
145
- if (result.type == 'log') {
146
- messagesDiv.appendChild(this.createDom('div', {className: 'resultMessage log'}, result.toString()));
147
- } else if (result.type == 'expect' && result.passed && !result.passed()) {
148
- messagesDiv.appendChild(this.createDom('div', {className: 'resultMessage fail'}, result.message));
149
-
150
- if (result.trace.stack) {
151
- messagesDiv.appendChild(this.createDom('div', {className: 'stackTrace'}, result.trace.stack));
152
- }
153
- }
154
- }
155
-
156
- if (messagesDiv.childNodes.length > 0) {
157
- specDiv.appendChild(messagesDiv);
158
- }
159
-
160
- this.suiteDivs[spec.suite.id].appendChild(specDiv);
161
- };
162
-
163
- jasmine.TrivialReporter.prototype.log = function() {
164
- var console = jasmine.getGlobal().console;
165
- if (console && console.log) {
166
- if (console.log.apply) {
167
- console.log.apply(console, arguments);
168
- } else {
169
- console.log(arguments); // ie fix: console.log.apply doesn't exist on ie
170
- }
171
- }
172
- };
173
-
174
- jasmine.TrivialReporter.prototype.getLocation = function() {
175
- return this.document.location;
176
- };
177
-
178
- jasmine.TrivialReporter.prototype.specFilter = function(spec) {
179
- var paramMap = {};
180
- var params = this.getLocation().search.substring(1).split('&');
181
- for (var i = 0; i < params.length; i++) {
182
- var p = params[i].split('=');
183
- paramMap[decodeURIComponent(p[0])] = decodeURIComponent(p[1]);
184
- }
185
-
186
- if (!paramMap.spec) {
187
- return true;
188
- }
189
- return spec.getFullName().indexOf(paramMap.spec) === 0;
190
- };
@@ -1,166 +0,0 @@
1
- body {
2
- font-family: "Helvetica Neue Light", "Lucida Grande", "Calibri", "Arial", sans-serif;
3
- }
4
-
5
-
6
- .jasmine_reporter a:visited, .jasmine_reporter a {
7
- color: #303;
8
- }
9
-
10
- .jasmine_reporter a:hover, .jasmine_reporter a:active {
11
- color: blue;
12
- }
13
-
14
- .run_spec {
15
- float:right;
16
- padding-right: 5px;
17
- font-size: .8em;
18
- text-decoration: none;
19
- }
20
-
21
- .jasmine_reporter {
22
- margin: 0 5px;
23
- }
24
-
25
- .banner {
26
- color: #303;
27
- background-color: #fef;
28
- padding: 5px;
29
- }
30
-
31
- .logo {
32
- float: left;
33
- font-size: 1.1em;
34
- padding-left: 5px;
35
- }
36
-
37
- .logo .version {
38
- font-size: .6em;
39
- padding-left: 1em;
40
- }
41
-
42
- .runner.running {
43
- background-color: yellow;
44
- }
45
-
46
-
47
- .options {
48
- text-align: right;
49
- font-size: .8em;
50
- }
51
-
52
-
53
-
54
-
55
- .suite {
56
- border: 1px outset gray;
57
- margin: 5px 0;
58
- padding-left: 1em;
59
- }
60
-
61
- .suite .suite {
62
- margin: 5px;
63
- }
64
-
65
- .suite.passed {
66
- background-color: #dfd;
67
- }
68
-
69
- .suite.failed {
70
- background-color: #fdd;
71
- }
72
-
73
- .spec {
74
- margin: 5px;
75
- padding-left: 1em;
76
- clear: both;
77
- }
78
-
79
- .spec.failed, .spec.passed, .spec.skipped {
80
- padding-bottom: 5px;
81
- border: 1px solid gray;
82
- }
83
-
84
- .spec.failed {
85
- background-color: #fbb;
86
- border-color: red;
87
- }
88
-
89
- .spec.passed {
90
- background-color: #bfb;
91
- border-color: green;
92
- }
93
-
94
- .spec.skipped {
95
- background-color: #bbb;
96
- }
97
-
98
- .messages {
99
- border-left: 1px dashed gray;
100
- padding-left: 1em;
101
- padding-right: 1em;
102
- }
103
-
104
- .passed {
105
- background-color: #cfc;
106
- display: none;
107
- }
108
-
109
- .failed {
110
- background-color: #fbb;
111
- }
112
-
113
- .skipped {
114
- color: #777;
115
- background-color: #eee;
116
- display: none;
117
- }
118
-
119
-
120
- /*.resultMessage {*/
121
- /*white-space: pre;*/
122
- /*}*/
123
-
124
- .resultMessage span.result {
125
- display: block;
126
- line-height: 2em;
127
- color: black;
128
- }
129
-
130
- .resultMessage .mismatch {
131
- color: black;
132
- }
133
-
134
- .stackTrace {
135
- white-space: pre;
136
- font-size: .8em;
137
- margin-left: 10px;
138
- max-height: 5em;
139
- overflow: auto;
140
- border: 1px inset red;
141
- padding: 1em;
142
- background: #eef;
143
- }
144
-
145
- .finished-at {
146
- padding-left: 1em;
147
- font-size: .6em;
148
- }
149
-
150
- .show-passed .passed,
151
- .show-skipped .skipped {
152
- display: block;
153
- }
154
-
155
-
156
- #jasmine_content {
157
- position:fixed;
158
- right: 100%;
159
- }
160
-
161
- .runner {
162
- border: 1px solid gray;
163
- display: block;
164
- margin: 5px 0;
165
- padding: 2px 0 2px 10px;
166
- }