teaspoon 0.9.1 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (214) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +141 -0
  3. data/README.md +9 -19
  4. data/{vendor → app}/assets/javascripts/support/bind-poly.js +0 -0
  5. data/{vendor → app}/assets/javascripts/support/sinon.js +0 -0
  6. data/app/assets/javascripts/teaspoon-filterer.js +55 -0
  7. data/app/assets/javascripts/teaspoon/error.coffee +5 -0
  8. data/app/assets/javascripts/teaspoon/{base/fixture.coffee → fixture.coffee} +15 -15
  9. data/app/assets/javascripts/teaspoon/{base/hook.coffee → hook.coffee} +0 -0
  10. data/app/assets/javascripts/teaspoon/{base/reporters → reporters}/console.coffee +18 -10
  11. data/app/assets/javascripts/teaspoon/{base/reporters → reporters}/html.coffee +43 -40
  12. data/app/assets/javascripts/teaspoon/{base/reporters → reporters}/html/base_view.coffee +0 -0
  13. data/app/assets/javascripts/teaspoon/{base/reporters → reporters}/html/failure_view.coffee +2 -0
  14. data/app/assets/javascripts/teaspoon/reporters/html/progress_view.coffee +18 -0
  15. data/app/assets/javascripts/teaspoon/{base/reporters/html/progress_view.coffee → reporters/html/radial_progress_view.coffee} +1 -34
  16. data/app/assets/javascripts/teaspoon/reporters/html/simple_progress_view.coffee +15 -0
  17. data/app/assets/javascripts/teaspoon/{base/reporters → reporters}/html/spec_view.coffee +5 -3
  18. data/app/assets/javascripts/teaspoon/{base/reporters → reporters}/html/suite_view.coffee +4 -2
  19. data/app/assets/javascripts/teaspoon/{base/reporters → reporters}/html/template.coffee +0 -0
  20. data/app/assets/javascripts/teaspoon/{base/runner.coffee → runner.coffee} +7 -3
  21. data/app/assets/javascripts/teaspoon/teaspoon.coffee +90 -32
  22. data/app/controllers/teaspoon/suite_controller.rb +5 -0
  23. data/app/views/teaspoon/suite/index.html.erb +1 -1
  24. data/lib/generators/teaspoon/install/install_generator.rb +67 -37
  25. data/lib/generators/teaspoon/install/templates/MISSING_FRAMEWORK +14 -0
  26. data/lib/generators/teaspoon/install/{POST_INSTALL → templates/POST_INSTALL} +0 -0
  27. data/lib/generators/teaspoon/install/templates/env.rb.tt +14 -0
  28. data/lib/generators/teaspoon/install/templates/{jasmine/env_comments.rb.tt → env_comments.rb.tt} +34 -43
  29. data/lib/tasks/teaspoon/info.rake +17 -0
  30. data/lib/teaspoon-devkit.rb +61 -0
  31. data/lib/teaspoon.rb +2 -0
  32. data/lib/teaspoon/command_line.rb +19 -14
  33. data/lib/teaspoon/configuration.rb +24 -35
  34. data/lib/teaspoon/console.rb +11 -21
  35. data/lib/teaspoon/coverage.rb +14 -7
  36. data/lib/teaspoon/deprecated.rb +22 -4
  37. data/lib/teaspoon/driver.rb +15 -0
  38. data/lib/teaspoon/driver/base.rb +7 -0
  39. data/lib/teaspoon/{drivers/capybara_webkit_driver.rb → driver/capybara_webkit.rb} +8 -5
  40. data/lib/teaspoon/{drivers/phantomjs_driver.rb → driver/phantomjs.rb} +8 -4
  41. data/lib/teaspoon/{drivers → driver}/phantomjs/runner.js +0 -0
  42. data/lib/teaspoon/{drivers/selenium_driver.rb → driver/selenium.rb} +11 -9
  43. data/lib/teaspoon/engine.rb +38 -25
  44. data/lib/teaspoon/environment.rb +24 -15
  45. data/lib/teaspoon/exceptions.rb +154 -41
  46. data/lib/teaspoon/exporter.rb +2 -2
  47. data/lib/teaspoon/formatter.rb +30 -0
  48. data/lib/teaspoon/{formatters → formatter}/base.rb +2 -36
  49. data/lib/teaspoon/{formatters/clean_formatter.rb → formatter/clean.rb} +4 -2
  50. data/lib/teaspoon/{formatters/documentation_formatter.rb → formatter/documentation.rb} +4 -3
  51. data/lib/teaspoon/{formatters/dot_formatter.rb → formatter/dot.rb} +4 -3
  52. data/lib/teaspoon/{formatters/json_formatter.rb → formatter/json.rb} +4 -2
  53. data/lib/teaspoon/{formatters/junit_formatter.rb → formatter/junit.rb} +3 -2
  54. data/lib/teaspoon/{formatters → formatter}/modules/report_module.rb +1 -1
  55. data/lib/teaspoon/{formatters/pride_formatter.rb → formatter/pride.rb} +4 -2
  56. data/lib/teaspoon/{formatters/rspec_html_formatter.rb → formatter/rspec_html.rb} +3 -2
  57. data/lib/teaspoon/{formatters/snowday_formatter.rb → formatter/snowday.rb} +3 -2
  58. data/lib/teaspoon/formatter/swayze_or_oprah.rb +111 -0
  59. data/lib/teaspoon/{formatters/tap_formatter.rb → formatter/tap.rb} +4 -2
  60. data/lib/teaspoon/{formatters/tap_y_formatter.rb → formatter/tap_y.rb} +3 -2
  61. data/lib/teaspoon/{formatters/teamcity_formatter.rb → formatter/teamcity.rb} +4 -2
  62. data/lib/teaspoon/framework.rb +17 -0
  63. data/lib/teaspoon/framework/base.rb +88 -0
  64. data/lib/teaspoon/instrumentation.rb +12 -2
  65. data/lib/teaspoon/registry.rb +47 -0
  66. data/lib/teaspoon/registry/has_default.rb +11 -0
  67. data/lib/teaspoon/runner.rb +6 -7
  68. data/lib/teaspoon/server.rb +2 -2
  69. data/lib/teaspoon/suite.rb +28 -30
  70. data/lib/teaspoon/utility.rb +5 -0
  71. data/lib/teaspoon/version.rb +1 -1
  72. metadata +52 -276
  73. data/app/assets/javascripts/teaspoon-jasmine.js +0 -1344
  74. data/app/assets/javascripts/teaspoon-mocha.js +0 -1350
  75. data/app/assets/javascripts/teaspoon-qunit.js +0 -1415
  76. data/app/assets/javascripts/teaspoon-teaspoon.js +0 -51
  77. data/app/assets/javascripts/teaspoon/base/teaspoon.coffee +0 -69
  78. data/app/assets/javascripts/teaspoon/jasmine.coffee +0 -119
  79. data/app/assets/javascripts/teaspoon/jasmine/reporters/html.coffee +0 -11
  80. data/app/assets/javascripts/teaspoon/mocha.coffee +0 -90
  81. data/app/assets/javascripts/teaspoon/mocha/reporters/console.coffee +0 -16
  82. data/app/assets/javascripts/teaspoon/mocha/reporters/html.coffee +0 -27
  83. data/app/assets/javascripts/teaspoon/qunit.coffee +0 -81
  84. data/app/assets/javascripts/teaspoon/qunit/reporters/console.coffee +0 -25
  85. data/app/assets/javascripts/teaspoon/qunit/reporters/html.coffee +0 -80
  86. data/lib/generators/teaspoon/install/templates/jasmine/env.rb +0 -11
  87. data/lib/generators/teaspoon/install/templates/jasmine/spec_helper.coffee +0 -31
  88. data/lib/generators/teaspoon/install/templates/jasmine/spec_helper.js +0 -31
  89. data/lib/generators/teaspoon/install/templates/mocha/env.rb +0 -11
  90. data/lib/generators/teaspoon/install/templates/mocha/env_comments.rb.tt +0 -187
  91. data/lib/generators/teaspoon/install/templates/mocha/spec_helper.coffee +0 -40
  92. data/lib/generators/teaspoon/install/templates/mocha/spec_helper.js +0 -40
  93. data/lib/generators/teaspoon/install/templates/qunit/env.rb +0 -11
  94. data/lib/generators/teaspoon/install/templates/qunit/env_comments.rb.tt +0 -187
  95. data/lib/generators/teaspoon/install/templates/qunit/test_helper.coffee +0 -29
  96. data/lib/generators/teaspoon/install/templates/qunit/test_helper.js +0 -30
  97. data/lib/teaspoon/drivers/base.rb +0 -10
  98. data/lib/teaspoon/formatters/description.rb +0 -36
  99. data/lib/teaspoon/formatters/swayze_or_oprah_formatter.rb +0 -101
  100. data/spec/dummy/Rakefile +0 -7
  101. data/spec/dummy/app/assets/javascripts/instrumented1.coffee +0 -1
  102. data/spec/dummy/app/assets/javascripts/instrumented2.coffee +0 -1
  103. data/spec/dummy/app/assets/javascripts/integration/integration.coffee +0 -1
  104. data/spec/dummy/app/assets/javascripts/integration/integration_spec.coffee +0 -32
  105. data/spec/dummy/app/assets/javascripts/integration/spec_helper.coffee +0 -7
  106. data/spec/dummy/app/assets/javascripts/specs/asset_spec.js +0 -11
  107. data/spec/dummy/config.ru +0 -15
  108. data/spec/dummy/config/application.rb +0 -29
  109. data/spec/dummy/config/boot.rb +0 -3
  110. data/spec/dummy/config/environment.rb +0 -5
  111. data/spec/dummy/config/environments/development.rb +0 -41
  112. data/spec/dummy/config/environments/production.rb +0 -79
  113. data/spec/dummy/config/environments/test.rb +0 -42
  114. data/spec/dummy/config/routes.rb +0 -2
  115. data/spec/dummy/config/secrets.yml +0 -22
  116. data/spec/dummy/log/.gitkeep +0 -0
  117. data/spec/dummy/public/favicon.ico +0 -0
  118. data/spec/dummy/script/rails +0 -6
  119. data/spec/features/console_reporter_spec.rb +0 -62
  120. data/spec/features/hooks_spec.rb +0 -60
  121. data/spec/features/html_reporter_spec.rb +0 -81
  122. data/spec/features/install_generator_spec.rb +0 -54
  123. data/spec/features/instrumentation_spec.rb +0 -21
  124. data/spec/fixtures/coverage.json +0 -243
  125. data/spec/javascripts/fixtures/_body.html.erb +0 -1
  126. data/spec/javascripts/fixtures/fixture.html.haml +0 -4
  127. data/spec/javascripts/fixtures/fixture.json +0 -4
  128. data/spec/javascripts/jasmine_helper.coffee +0 -3
  129. data/spec/javascripts/mocha_helper.coffee +0 -4
  130. data/spec/javascripts/spec_helper.coffee +0 -7
  131. data/spec/javascripts/stylesheets/stylesheet.css.scss +0 -0
  132. data/spec/javascripts/support/json2.js +0 -486
  133. data/spec/javascripts/support/support.js.coffee +0 -0
  134. data/spec/javascripts/teaspoon/base/fixture_spec.coffee +0 -93
  135. data/spec/javascripts/teaspoon/base/reporters/console_spec.coffee +0 -162
  136. data/spec/javascripts/teaspoon/base/reporters/html/base_view_spec.coffee +0 -88
  137. data/spec/javascripts/teaspoon/base/reporters/html/failure_view_spec.coffee +0 -28
  138. data/spec/javascripts/teaspoon/base/reporters/html/progress_view_spec.coffee +0 -1
  139. data/spec/javascripts/teaspoon/base/reporters/html/spec_view_spec.coffee +0 -1
  140. data/spec/javascripts/teaspoon/base/reporters/html/suite_view_spec.coffee +0 -1
  141. data/spec/javascripts/teaspoon/base/reporters/html_spec.coffee +0 -372
  142. data/spec/javascripts/teaspoon/base/runner_spec.coffee +0 -58
  143. data/spec/javascripts/teaspoon/base/teaspoon_spec.coffee +0 -47
  144. data/spec/javascripts/teaspoon/jasmine/fixture_jspec.coffee +0 -13
  145. data/spec/javascripts/teaspoon/jasmine/models_jspec.coffee +0 -101
  146. data/spec/javascripts/teaspoon/jasmine/reporters/html_jspec.coffee +0 -17
  147. data/spec/javascripts/teaspoon/jasmine/runner_jspec.coffee +0 -59
  148. data/spec/javascripts/teaspoon/jasmine/spec_jspec.coffee +0 -3
  149. data/spec/javascripts/teaspoon/mocha/fixture_mspec.coffee +0 -12
  150. data/spec/javascripts/teaspoon/mocha/models_mspec.coffee +0 -93
  151. data/spec/javascripts/teaspoon/mocha/reporters/console_mspec.coffee +0 -24
  152. data/spec/javascripts/teaspoon/mocha/reporters/html_mspec.coffee +0 -41
  153. data/spec/javascripts/teaspoon/mocha/runner_mspec.coffee +0 -23
  154. data/spec/javascripts/teaspoon/mocha/spec_mspec.coffee +0 -9
  155. data/spec/javascripts/teaspoon/other/erb_spec.js.coffee.erb +0 -4
  156. data/spec/javascripts/teaspoon/phantomjs/runner_spec.coffee +0 -161
  157. data/spec/javascripts/turbolinks_helper.coffee +0 -2
  158. data/spec/spec_helper.rb +0 -25
  159. data/spec/support/aruba.rb +0 -15
  160. data/spec/teaspoon/command_line_spec.rb +0 -157
  161. data/spec/teaspoon/configuration_spec.rb +0 -236
  162. data/spec/teaspoon/console_spec.rb +0 -224
  163. data/spec/teaspoon/coverage_spec.rb +0 -118
  164. data/spec/teaspoon/drivers/base_spec.rb +0 -5
  165. data/spec/teaspoon/drivers/capybara_webkit_driver_spec.rb +0 -39
  166. data/spec/teaspoon/drivers/phantomjs_driver_spec.rb +0 -66
  167. data/spec/teaspoon/drivers/selenium_driver_spec.rb +0 -68
  168. data/spec/teaspoon/engine_spec.rb +0 -22
  169. data/spec/teaspoon/environment_spec.rb +0 -109
  170. data/spec/teaspoon/exceptions_spec.rb +0 -57
  171. data/spec/teaspoon/exporter_spec.rb +0 -96
  172. data/spec/teaspoon/formatters/base_spec.rb +0 -259
  173. data/spec/teaspoon/formatters/clean_formatter_spec.rb +0 -37
  174. data/spec/teaspoon/formatters/documentation_formatter_spec.rb +0 -127
  175. data/spec/teaspoon/formatters/dot_formatter_spec.rb +0 -116
  176. data/spec/teaspoon/formatters/json_formatter_spec.rb +0 -77
  177. data/spec/teaspoon/formatters/junit_formatter_spec.rb +0 -114
  178. data/spec/teaspoon/formatters/pride_formatter_spec.rb +0 -37
  179. data/spec/teaspoon/formatters/rspec_html_formatter_spec.rb +0 -107
  180. data/spec/teaspoon/formatters/snowday_formatter_spec.rb +0 -35
  181. data/spec/teaspoon/formatters/tap_formatter_spec.rb +0 -72
  182. data/spec/teaspoon/formatters/tap_y_formatter_spec.rb +0 -80
  183. data/spec/teaspoon/formatters/teamcity_formatter_spec.rb +0 -148
  184. data/spec/teaspoon/instrumentation_spec.rb +0 -113
  185. data/spec/teaspoon/result_spec.rb +0 -98
  186. data/spec/teaspoon/runner_spec.rb +0 -116
  187. data/spec/teaspoon/server_spec.rb +0 -105
  188. data/spec/teaspoon/suite_spec.rb +0 -138
  189. data/spec/teaspoon_env.rb +0 -39
  190. data/test/javascripts/qunit_helper.coffee +0 -3
  191. data/test/javascripts/teaspoon/qunit/fixture_test.coffee +0 -10
  192. data/test/javascripts/teaspoon/qunit/models_test.coffee +0 -66
  193. data/test/javascripts/teaspoon/qunit/reporters/console_test.coffee +0 -3
  194. data/test/javascripts/teaspoon/qunit/reporters/html/failure_view_test.coffee +0 -3
  195. data/test/javascripts/teaspoon/qunit/reporters/html/spec_view_test.coffee +0 -3
  196. data/test/javascripts/teaspoon/qunit/reporters/html/suite_view_test.coffee +0 -3
  197. data/test/javascripts/teaspoon/qunit/reporters/html_test.coffee +0 -3
  198. data/test/javascripts/teaspoon/qunit/runner_test.coffee +0 -18
  199. data/vendor/assets/javascripts/jasmine/1.3.1.js +0 -2602
  200. data/vendor/assets/javascripts/jasmine/2.0.0.js +0 -2412
  201. data/vendor/assets/javascripts/jasmine/MIT.LICENSE +0 -20
  202. data/vendor/assets/javascripts/mocha/1.10.0.js +0 -5374
  203. data/vendor/assets/javascripts/mocha/1.17.1.js +0 -5813
  204. data/vendor/assets/javascripts/mocha/MIT.LICENSE +0 -22
  205. data/vendor/assets/javascripts/qunit/1.12.0.js +0 -2212
  206. data/vendor/assets/javascripts/qunit/1.14.0.js +0 -2288
  207. data/vendor/assets/javascripts/qunit/MIT.LICENSE +0 -21
  208. data/vendor/assets/javascripts/support/chai-1.10.0.js +0 -4800
  209. data/vendor/assets/javascripts/support/chai-jq-0.0.7.js +0 -524
  210. data/vendor/assets/javascripts/support/chai.js +0 -4782
  211. data/vendor/assets/javascripts/support/expect.js +0 -1284
  212. data/vendor/assets/javascripts/support/jasmine-jquery-1.7.0.js +0 -720
  213. data/vendor/assets/javascripts/support/jasmine-jquery-2.0.0.js +0 -812
  214. data/vendor/assets/javascripts/support/sinon-chai.js +0 -126
@@ -1,51 +0,0 @@
1
- (function() {
2
- var TeaspoonInterface,
3
- bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
4
-
5
- TeaspoonInterface = (function() {
6
- function TeaspoonInterface() {
7
- this.filter = bind(this.filter, this);
8
- this.files = $u("#teaspoon-suite-list .file a");
9
- this.input = $u("#teaspoon-filter-input")[0];
10
- this.input.value = "";
11
- this.input.onkeyup = this.filter;
12
- }
13
-
14
- TeaspoonInterface.prototype.filter = function() {
15
- var file, i, len, ref, results;
16
- ref = this.files;
17
- results = [];
18
- for (i = 0, len = ref.length; i < len; i++) {
19
- file = ref[i];
20
- if (LiquidMetal.score(file.innerHTML, this.input.value) > 0) {
21
- results.push(file.parentNode.style.display = "block");
22
- } else {
23
- results.push(file.parentNode.style.display = "none");
24
- }
25
- }
26
- return results;
27
- };
28
-
29
- return TeaspoonInterface;
30
-
31
- })();
32
-
33
- window.onload = function() {
34
- return new TeaspoonInterface();
35
- };
36
-
37
-
38
- /*!
39
- * LiquidMetal
40
- * Copyright (c) 2009, Ryan McGeary (ryanonjavascript -[at]- mcgeary [*dot*] org)
41
- */
42
- var LiquidMetal=function(){var l=0.0;var m=1.0;var n=0.8;var o=0.9;var p=0.85;return{score:function(a,b){if(b.length==0)return n;if(b.length>a.length)return l;var c=this.buildScoreArray(a,b);var d=0.0;for(var i=0;i<c.length;i++){d+=c[i]}return(d/c.length)},buildScoreArray:function(a,b){var d=new Array(a.length);var e=a.toLowerCase();var f=b.toLowerCase().split("");var g=-1;var h=false;for(var i=0;i<f.length;i++){var c=f[i];var j=e.indexOf(c,g+1);if(j<0)return fillArray(d,l);if(j==0)h=true;if(isNewWord(a,j)){d[j-1]=1;fillArray(d,p,g+1,j-1)}else if(isUpperCase(a,j)){fillArray(d,p,g+1,j)}else{fillArray(d,l,g+1,j)}d[j]=m;g=j}var k=h?o:n;fillArray(d,k,g+1);return d}};function isUpperCase(a,b){var c=a.charAt(b);return("A"<=c&&c<="Z")}function isNewWord(a,b){var c=a.charAt(b-1);return(c==" "||c=="\t")}function fillArray(a,b,c,d){c=Math.max(c||0,0);d=Math.min(d||a.length,a.length);for(var i=c;i<d;i++){a[i]=b}return a}}();
43
-
44
- /*!
45
- * uSelector
46
- * author: Fabio Miranda Costa | github: fabiomcosta | twitter: @fabiomiranda | license: MIT-style license
47
- */
48
- (function(h,i){var f,c,j,k,m={},e,l,q=/^\s+|\s+$/g,r=!!i.querySelectorAll,g=function(d,b,a){f=a||[];e=b||g.context;if(r)try{n(e.querySelectorAll(d));return f}catch(v){}l=e.ownerDocument||e;d=d.replace(q,"");for(c={};d=d.replace(/([#.:])?([^#.:]*)/,s););d=(b=c.id)&&c.tag||c.classes||c.pseudos||!b&&(c.classes||c.pseudos)?t:o;if(b){if(a=b=l.getElementById(b))if(!(a=l===e))a:{a=b;do if(a===e){a=true;break a}while(a=a.parentNode);a=false}a&&d([b])}else d(e.getElementsByTagName(c.tag||"*"));return f},u=function(d){if(c.tag){var b=d.nodeName.toUpperCase();if(c.tag=="*"){if(b<"@")return false}else if(b!=c.tag)return false}if(c.id&&d.getAttribute("id")!=c.id)return false;if(j=c.classes){var a=" "+d.className+" ";for(b=j.length;b--;)if(a.indexOf(" "+j[b]+" ")<0)return false}if(k=c.pseudos)for(b=k.length;b--;){a=m[k[b]];if(!(a&&a.call(g,d)))return false}return true},s=function(d,b,a){if(b)if(b=="#")c.id=a;else if(b==".")if(c.classes)c.classes.push(a);else c.classes=[a];else{if(b==":")if(c.pseudos)c.pseudos.push(a);else c.pseudos=[a]}else c.tag=a.toUpperCase();return""},p=Array.prototype.slice,n=function(d){f=p.call(d,0)},o=function(d){for(var b=0,a;a=d[b++];)f.push(a)};try{p.call(i.documentElement.childNodes,0)}catch(w){n=o}var t=function(d){for(var b=0,a;a=d[b++];)u(a)&&f.push(a)};g.pseudos=m;g.context=i;h.uSelector=g;h.$u||(h.$u=g)})(this,document);
49
- ;
50
-
51
- }).call(this);
@@ -1,69 +0,0 @@
1
- #= require_self
2
- #= require teaspoon/base/runner
3
- #= require teaspoon/base/fixture
4
- #= require teaspoon/base/hook
5
- #= require teaspoon/base/reporters/html
6
- #= require teaspoon/base/reporters/console
7
-
8
- class @Teaspoon
9
- @defer: false
10
- @slow: 75
11
- @root: window.location.pathname.replace(/\/+(index\.html)?$/, "").replace(/\/[^\/]*$/, "")
12
- @started: false
13
- @finished: false
14
- @Reporters: {}
15
- @Date: Date
16
- @location: window.location
17
- @messages: []
18
-
19
- @execute: ->
20
- if Teaspoon.defer
21
- Teaspoon.defer = false
22
- return
23
- Teaspoon.reload() if Teaspoon.started
24
- Teaspoon.started = true
25
- new Teaspoon.Runner()
26
-
27
-
28
- @reload: ->
29
- window.location.reload()
30
-
31
-
32
- @onWindowLoad: (method) ->
33
- originalOnload = window.onload
34
- window.onload = ->
35
- originalOnload() if originalOnload && originalOnload.call
36
- method()
37
-
38
-
39
- @resolveDependenciesFromParams: (all = []) ->
40
- deps = []
41
- return all if (paths = Teaspoon.location.search.match(/[\?&]file(\[\])?=[^&\?]*/gi)) == null
42
-
43
- for path in paths
44
- parts = decodeURIComponent(path.replace(/\+/g, " ")).match(/\/(.+)\.(js|js.coffee|coffee)$/i)
45
- continue if parts == null
46
- file = parts[1].substr(parts[1].lastIndexOf("/") + 1)
47
- for dep in all then deps.push(dep) if dep.indexOf(file) >= 0
48
- deps
49
-
50
-
51
- @log: ->
52
- Teaspoon.messages.push(arguments[0])
53
- try console.log(arguments...)
54
- catch e
55
- throw new Error("Unable to use console.log for logging")
56
-
57
-
58
- @getMessages: ->
59
- messages = Teaspoon.messages
60
- Teaspoon.messages = []
61
- messages
62
-
63
-
64
-
65
- class Teaspoon.Error extends Error
66
-
67
- constructor: (message) ->
68
- @name = "TeaspoonError"
69
- @message = (message || "")
@@ -1,119 +0,0 @@
1
- #= require teaspoon/base/teaspoon
2
- #= require teaspoon/jasmine/reporters/html
3
-
4
- unless jasmine?
5
- throw new Teaspoon.Error('Jasmine not found -- use `suite.use_framework :jasmine` and adjust or remove the `suite.javascripts` directive.')
6
-
7
- class Teaspoon.Runner extends Teaspoon.Runner
8
-
9
- constructor: ->
10
- super
11
- env.execute()
12
-
13
-
14
- setup: ->
15
- env.updateInterval = 1000
16
-
17
- # add the spec filter
18
- if grep = @params["grep"]
19
- env.specFilter = (spec) -> return spec.getFullName().indexOf(grep) == 0
20
-
21
- # add the reporter and set the filter
22
- reporter = new (@getReporter())()
23
- env.addReporter(reporter)
24
-
25
- # add fixture support
26
- @addFixtureSupport()
27
-
28
-
29
- addFixtureSupport: ->
30
- return unless jasmine.getFixtures && @fixturePath
31
- jasmine.getFixtures().containerId = "teaspoon-fixtures"
32
- jasmine.getFixtures().fixturesPath = @fixturePath
33
- jasmine.getStyleFixtures().fixturesPath = @fixturePath
34
- jasmine.getJSONFixtures().fixturesPath = @fixturePath
35
-
36
-
37
-
38
- class Teaspoon.Spec
39
-
40
- constructor: (@spec) ->
41
- @fullDescription = @spec.getFullName()
42
- @description = @spec.description
43
- @link = "?grep=#{encodeURIComponent(@fullDescription)}"
44
- @parent = @spec.suite
45
- @suiteName = @parent.getFullName()
46
- @viewId = @spec.viewId
47
- @pending = @spec.pending
48
-
49
-
50
- errors: ->
51
- return [] unless @spec.results
52
- for item in @spec.results().getItems()
53
- continue if item.passed()
54
- {message: item.message, stack: item.trace.stack}
55
-
56
-
57
- getParents: ->
58
- return @parents if @parents
59
- @parents ||= []
60
- parent = @parent
61
- while parent
62
- parent = new Teaspoon.Suite(parent)
63
- @parents.unshift(parent)
64
- parent = parent.parent
65
- @parents
66
-
67
-
68
- result: ->
69
- results = @spec.results()
70
- status = "failed"
71
- status = "passed" if results.passed()
72
- status = "pending" if @spec.pending
73
- status: status
74
- skipped: results.skipped
75
-
76
-
77
-
78
- class Teaspoon.Suite
79
-
80
- constructor: (@suite) ->
81
- @fullDescription = @suite.getFullName()
82
- @description = @suite.description
83
- @link = "?grep=#{encodeURIComponent(@fullDescription)}"
84
- @parent = @suite.parentSuite
85
- @viewId = @suite.viewId
86
-
87
-
88
-
89
- class Teaspoon.fixture extends Teaspoon.fixture
90
-
91
- window.fixture = @
92
-
93
- @load: ->
94
- args = arguments
95
- throw "Teaspoon can't load fixtures outside of describe." unless env.currentSuite || env.currentSpec
96
- if env.currentSuite
97
- env.beforeEach => fixture.__super__.constructor.load.apply(@, args)
98
- env.afterEach => @cleanup()
99
- super
100
- else
101
- env.currentSpec.after => @cleanup()
102
- super
103
-
104
-
105
- @set: ->
106
- args = arguments
107
- throw "Teaspoon can't load fixtures outside of describe." unless env.currentSuite || env.currentSpec
108
- if env.currentSuite
109
- env.beforeEach => fixture.__super__.constructor.set.apply(@, args)
110
- env.afterEach => @cleanup()
111
- super
112
- else
113
- env.currentSpec.after => @cleanup()
114
- super
115
-
116
-
117
-
118
- # set the environment
119
- env = jasmine.getEnv()
@@ -1,11 +0,0 @@
1
- class Teaspoon.Reporters.HTML extends Teaspoon.Reporters.HTML
2
-
3
- readConfig: ->
4
- super
5
- jasmine.CATCH_EXCEPTIONS = @config["use-catch"]
6
-
7
-
8
- envInfo: ->
9
- ver = jasmine.getEnv().version()
10
- verString = [ver.major, ver.minor, ver.build].join(".")
11
- "jasmine #{verString} revision #{ver.revision}"
@@ -1,90 +0,0 @@
1
- #= require teaspoon/base/teaspoon
2
- #= require teaspoon/mocha/reporters/console
3
- #= require teaspoon/mocha/reporters/html
4
-
5
- unless mocha?
6
- throw new Teaspoon.Error('Mocha not found -- use `suite.use_framework :mocha` and adjust or remove the `suite.javascripts` directive.')
7
-
8
- class Teaspoon.Runner extends Teaspoon.Runner
9
-
10
- constructor: ->
11
- super
12
- env.run()
13
- env.started = true
14
- afterEach -> Teaspoon.fixture.cleanup()
15
-
16
-
17
- setup: ->
18
- # add the reporter and set the filter
19
- reporter = @getReporter()
20
- env.setup(reporter: reporter)
21
-
22
-
23
-
24
- class Teaspoon.Spec
25
-
26
- constructor: (@spec) ->
27
- @fullDescription = @spec.fullTitle()
28
- @description = @spec.title
29
- @link = "?grep=#{encodeURIComponent(@fullDescription)}"
30
- @parent = @spec.parent
31
- @suiteName = @parent.fullTitle()
32
- @viewId = @spec.viewId
33
- @pending = @spec.pending
34
-
35
-
36
- errors: ->
37
- return [] unless @spec.err
38
- [@spec.err]
39
-
40
-
41
- getParents: ->
42
- return @parents if @parents
43
- @parents ||= []
44
- parent = @parent
45
- while parent
46
- parent = new Teaspoon.Suite(parent)
47
- @parents.unshift(parent)
48
- parent = parent.parent
49
- @parents
50
-
51
-
52
- result: ->
53
- status = "failed"
54
- status = "passed" if @spec.state == "passed" || @spec.state == "skipped"
55
- status = "pending" if @spec.pending
56
- status: status
57
- skipped: @spec.state == "skipped"
58
-
59
-
60
-
61
- class Teaspoon.Suite
62
-
63
- constructor: (@suite) ->
64
- @fullDescription = @suite.fullTitle()
65
- @description = @suite.title
66
- @link = "?grep=#{encodeURIComponent(@fullDescription)}"
67
- @parent = if @suite.parent?.root then null else @suite.parent
68
- @viewId = @suite.viewId
69
-
70
-
71
-
72
- class Teaspoon.fixture extends Teaspoon.fixture
73
-
74
- window.fixture = @
75
-
76
- @load: ->
77
- args = arguments
78
- if env.started then super
79
- else beforeEach => fixture.__super__.constructor.load.apply(@, args)
80
-
81
-
82
- @set: ->
83
- args = arguments
84
- if env.started then super
85
- else beforeEach => fixture.__super__.constructor.set.apply(@, args)
86
-
87
-
88
-
89
- # set the environment
90
- env = mocha.setup("bdd")
@@ -1,16 +0,0 @@
1
- class Teaspoon.Reporters.Console extends Teaspoon.Reporters.Console
2
-
3
- constructor: (runner) ->
4
- super
5
- @reportRunnerStarting(runner)
6
- runner.on("fail", @reportSpecResults)
7
- runner.on("test end", @reportSpecResults)
8
- runner.on("end", @reportRunnerResults)
9
-
10
-
11
- reportSpecResults: (spec, err) =>
12
- if err
13
- spec.err = err
14
- @reportSpecResults(spec) if spec.type == "hook"
15
- return
16
- super
@@ -1,27 +0,0 @@
1
- class Teaspoon.Reporters.HTML extends Teaspoon.Reporters.HTML
2
-
3
- constructor: (runner) ->
4
- super
5
- @reportRunnerStarting(runner)
6
- runner.on("fail", @reportSpecResults)
7
- runner.on("test end", @reportSpecResults)
8
- runner.on("end", @reportRunnerResults)
9
-
10
-
11
- reportSpecResults: (spec, err) =>
12
- if err
13
- spec.err = err
14
- @reportSpecResults(spec) if spec.type == "hook"
15
- return
16
- @reportSpecStarting(spec)
17
- super
18
-
19
-
20
- envInfo: ->
21
- "mocha #{_mocha_version || "[unknown version]"}"
22
-
23
-
24
- class Teaspoon.Reporters.HTML.SpecView extends Teaspoon.Reporters.HTML.SpecView
25
-
26
- updateState: (state) ->
27
- super(state, @spec.spec.duration)
@@ -1,81 +0,0 @@
1
- #= require teaspoon/base/teaspoon
2
- #= require teaspoon/qunit/reporters/console
3
- #= require teaspoon/qunit/reporters/html
4
-
5
- unless QUnit?
6
- throw new Teaspoon.Error('QUnit not found -- use `suite.use_framework :qunit` and adjust or remove the `suite.javascripts` directive.')
7
-
8
- class Teaspoon.Runner extends Teaspoon.Runner
9
-
10
- constructor: ->
11
- super
12
- env.start()
13
-
14
-
15
- setup: ->
16
- new (@getReporter())(env)
17
-
18
-
19
-
20
- class Teaspoon.Spec
21
-
22
- constructor: (@spec) ->
23
- @fullDescription = "#{@spec.module} #{@spec.name}"
24
- @description = "#{@spec.name} (#{@spec.failed}, #{@spec.passed}, #{@spec.total})"
25
- @link = "?grep=#{encodeURIComponent("#{@spec.module}: #{@spec.name}")}"
26
- @parent = if @spec.module then new Teaspoon.Suite({description: @spec.module}) else null
27
- @suiteName = @spec.module
28
- @viewId = @spec.viewId
29
- @pending = false
30
-
31
-
32
- errors: ->
33
- return [] unless @spec.failed
34
- for item in @spec.assertions
35
- continue if item.result
36
- @provideFallbackMessage(item)
37
- {message: item.message, stack: item.source}
38
-
39
-
40
- getParents: ->
41
- return [] unless @parent
42
- [@parent]
43
-
44
-
45
- result: ->
46
- status = "failed"
47
- status = "passed" unless @spec.failed
48
- status: status
49
- skipped: false
50
-
51
-
52
- provideFallbackMessage: (item) ->
53
- return if item.message
54
-
55
- if item.actual && item.expected
56
- item.message ||= "Expected #{JSON.stringify(item.actual)} to equal #{JSON.stringify(item.expected)}"
57
- else
58
- item.message = 'failed'
59
-
60
-
61
-
62
- class Teaspoon.Suite
63
-
64
- constructor: (@suite) ->
65
- @fullDescription = @suite.description
66
- @description = @suite.description
67
- @link = "?grep=#{encodeURIComponent(@fullDescription)}"
68
- @parent = null
69
-
70
-
71
- # set the environment
72
- env = QUnit
73
- env.config.autostart = false
74
- env.config.altertitle = false
75
- env.config.filter = Teaspoon.Runner.prototype.getParams()["grep"]
76
-
77
- window.fixture = Teaspoon.fixture
78
- originalReset = env.reset
79
- env.reset = ->
80
- originalReset()
81
- Teaspoon.fixture.cleanup()