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
File without changes
@@ -1,93 +0,0 @@
1
- describe "Teaspoon.fixture", ->
2
-
3
- beforeEach ->
4
- fixture.cache = {}
5
- fixture.cleanup()
6
- @mockXhr =
7
- readyState: 4
8
- status: 200
9
- responseText: "_content_"
10
- getResponseHeader: -> "_type_"
11
- open: ->
12
- send: ->
13
- @xhrSpy = spyOn(@mockXhr, 'open')
14
- @xhrSpy
15
- try spyOn(window, 'XMLHttpRequest').andReturn(@mockXhr)
16
- catch e
17
- spyOn(window, 'ActiveXObject').andReturn(@mockXhr)
18
-
19
-
20
- describe "@load", ->
21
-
22
- it "loads all of the files requested", ->
23
- fixture.load("fixture.html", "fixture.json")
24
- expect(@xhrSpy).toHaveBeenCalledWith("GET", "#{Teaspoon.root}/fixtures/fixture.html", false)
25
- expect(@xhrSpy).toHaveBeenCalledWith("GET", "#{Teaspoon.root}/fixtures/fixture.json", false)
26
-
27
- it "caches the type/contents of those files", ->
28
- fixture.load("fixture.html")
29
- @mockXhr.onreadystatechange()
30
- expect(fixture.cache["fixture.html"]).toEqual(type: "_type_", content: "_content_")
31
-
32
- it "throws an exception if unable to load a file", ->
33
- fixture.load("foo.html")
34
- @mockXhr.status = 500
35
- expect(=> @mockXhr.onreadystatechange()).toThrow("Unable to load fixture \"foo.html\".")
36
-
37
- it "adds the contents of files to a fixture element", ->
38
- fixture.load("fixture.html")
39
- @mockXhr.onreadystatechange()
40
- expect(document.getElementById("teaspoon-fixtures").tagName).toBe("DIV")
41
- expect(document.getElementById("teaspoon-fixtures").innerHTML).toBe("_content_")
42
- expect(document.getElementById("teaspoon-fixtures")).toBe(fixture.el)
43
-
44
- it "allows appending file contents to the fixture element", ->
45
- fixture.load("fixture.html1")
46
- @mockXhr.onreadystatechange()
47
- expect(document.getElementById("teaspoon-fixtures").tagName).toBe("DIV")
48
- expect(document.getElementById("teaspoon-fixtures").innerHTML).toBe("_content_")
49
- fixture.load("fixture.html2", true)
50
- @mockXhr.onreadystatechange()
51
- expect(document.getElementById("teaspoon-fixtures").innerHTML).toBe("_content__content_")
52
- fixture.load("fixture.html3", false)
53
- @mockXhr.onreadystatechange()
54
- expect(document.getElementById("teaspoon-fixtures").innerHTML).toBe("_content_")
55
-
56
- it "handles JSON fixtures", ->
57
- @mockXhr.responseText = '{"foo": "bar"}'
58
- @mockXhr.getResponseHeader = -> "application/json; encoding-blah"
59
- fixture.load("fixture.json")
60
- @mockXhr.onreadystatechange()
61
- expect(fixture.json.length).toBe(1)
62
- expect(fixture.json[0]).toEqual(foo: "bar")
63
-
64
-
65
- describe "@set", ->
66
-
67
- it "adds all the contents passed to a fixture element", ->
68
- fixture.set("_content1_", "_content2_")
69
- expect(document.getElementById("teaspoon-fixtures").tagName).toBe("DIV")
70
- expect(document.getElementById("teaspoon-fixtures").innerHTML).toBe("_content1__content2_")
71
-
72
- it "allows appending contents to the fixture element", ->
73
- fixture.set("_content1_")
74
- expect(document.getElementById("teaspoon-fixtures").tagName).toBe("DIV")
75
- expect(document.getElementById("teaspoon-fixtures").innerHTML).toBe("_content1_")
76
- fixture.set("_content2_", true)
77
- expect(document.getElementById("teaspoon-fixtures").innerHTML).toBe("_content1__content2_")
78
- fixture.set("_content3_", false)
79
- expect(document.getElementById("teaspoon-fixtures").innerHTML).toBe("_content3_")
80
-
81
-
82
- describe "@preload", ->
83
-
84
- it "loads all of the files requested", ->
85
- fixture.preload("fixture.html", "fixture.json")
86
- expect(@xhrSpy).toHaveBeenCalledWith("GET", "#{Teaspoon.root}/fixtures/fixture.html", false)
87
- expect(@xhrSpy).toHaveBeenCalledWith("GET", "#{Teaspoon.root}/fixtures/fixture.json", false)
88
- expect(document.getElementById("teaspoon-fixtures")).toBe(null)
89
-
90
- it "caches the type/contents of those files", ->
91
- fixture.preload("fixture.html")
92
- @mockXhr.onreadystatechange()
93
- expect(fixture.cache["fixture.html"]).toEqual(type: "_type_", content: "_content_")
@@ -1,162 +0,0 @@
1
- describe "Teaspoon.Reporters.Console", ->
2
-
3
- beforeEach ->
4
- @logSpy = spyOn(Teaspoon, "log")
5
- spyOn(Date.prototype, "getTime").andReturn(666)
6
-
7
- @spec =
8
- fullDescription: "_spec_description_"
9
- description: "_spec_name_"
10
- suiteName: "_suite_name_"
11
- link: "?grep=_spec_description_"
12
- result: -> {status: "passed", skipped: false}
13
- errors: -> [{message: "_message_", trace: {stack: "_stack_"}}]
14
- getParents: -> [{fullDescription: "_suite_full_description", description: "_suite_description_"}]
15
-
16
- @reporter = new Teaspoon.Reporters.Console()
17
- @reporter.spec = @spec
18
- @normalizeSpy = spyOn(Teaspoon, "Spec").andReturn(@spec)
19
-
20
-
21
- describe "constructor", ->
22
-
23
- it "tracks failures, pending, total, and start time", ->
24
- expect(@reporter.start).toBeDefined()
25
-
26
-
27
- describe "#reportRunnerStarting", ->
28
-
29
- it "logs the information", ->
30
- spy = spyOn(@reporter, "log")
31
- spyOn(JSON, 'parse').andReturn('_date_time_')
32
- @reporter.reportRunnerStarting({total: 42})
33
- expect(spy).toHaveBeenCalledWith
34
- type: "runner"
35
- total: 42
36
- start: "_date_time_"
37
-
38
-
39
- describe "#reportSuites", ->
40
-
41
- it "logs the information", ->
42
- spy = spyOn(@reporter, "log")
43
- @reporter.reportSuites()
44
- expect(spy).toHaveBeenCalledWith
45
- type: "suite"
46
- label: "_suite_description_"
47
- level: 0
48
-
49
- it "doesn't log the suite more than once.", ->
50
- spy = spyOn(@reporter, "log")
51
- @reporter.reportSuites()
52
- @reporter.reportSuites()
53
- expect(spy.callCount).toBe(1)
54
-
55
-
56
- describe "#reportSpecResults", ->
57
-
58
- it "normalizes the spec", ->
59
- @reporter.reportSpecResults()
60
- expect(@normalizeSpy).toHaveBeenCalled()
61
-
62
- it "logs the information", ->
63
- spy = spyOn(@reporter, "log")
64
- @reporter.reportSpecResults()
65
- expect(spy).toHaveBeenCalledWith
66
- type: "spec"
67
- suite: "_suite_name_"
68
- label: "_spec_name_"
69
- status: "passed"
70
- skipped: false
71
-
72
- describe "pending tests", ->
73
-
74
- beforeEach ->
75
- @trackSpy = spyOn(@reporter, "trackPending")
76
- @spec.result = -> {status: "pending", skipped: false}
77
-
78
- it "tracks that it was pending", ->
79
- @reporter.reportSpecResults()
80
- expect(@trackSpy).toHaveBeenCalled()
81
-
82
- describe "skipped tests", ->
83
-
84
- beforeEach ->
85
- @reportSuitesSpy = spyOn(@reporter, "reportSuites")
86
- @logSpy = spyOn(@reporter, "log")
87
- @spec.result = -> {status: "pending", skipped: true}
88
-
89
- it "doesn't report the suite or log the results", ->
90
- @reporter.reportSpecResults()
91
- expect(@reportSuitesSpy).not.toHaveBeenCalled()
92
- expect(@logSpy).not.toHaveBeenCalled()
93
-
94
- describe "failing tests", ->
95
-
96
- beforeEach ->
97
- @trackSpy = spyOn(@reporter, "trackFailure")
98
- @spec.result = -> {status: "failed", skipped: false}
99
-
100
- it "tracks the failure", ->
101
- @reporter.reportSpecResults()
102
- expect(@trackSpy).toHaveBeenCalled()
103
-
104
-
105
- describe "#trackPending", ->
106
- beforeEach ->
107
- @reporter.spec = @spec
108
- @spec.result = -> {status: "pending", skipped: false}
109
-
110
- it "logs the status as 'pending'", ->
111
- spy = spyOn(@reporter, "log")
112
- @reporter.trackPending()
113
- expect(spy).toHaveBeenCalledWith
114
- type: "spec"
115
- suite: "_suite_name_"
116
- label: "_spec_name_"
117
- status: "pending"
118
- skipped: false
119
-
120
-
121
- describe "#trackFailure", ->
122
- beforeEach ->
123
- @reporter.spec = @spec
124
- @spec.result = -> {status: "failed", skipped: false}
125
-
126
- it "logs the status as 'failed'", ->
127
- spy = spyOn(@reporter, "log")
128
- @reporter.trackFailure()
129
- expect(spy).toHaveBeenCalledWith
130
- type: "spec"
131
- suite: "_suite_name_"
132
- label: "_spec_name_"
133
- status: "failed"
134
- skipped: false
135
- link: "_spec_description_"
136
- message: "_message_"
137
- trace: "_message_"
138
-
139
-
140
- describe "#reportRunnerResults", ->
141
-
142
- it "logs the results", ->
143
- spy = spyOn(@reporter, "log")
144
- window.__coverage__ ||= {}
145
- @reporter.reportRunnerResults()
146
- Teaspoon.finished = false
147
- args = spy.mostRecentCall.args[0]
148
- expect(args["type"]).toEqual("result")
149
- expect(args["elapsed"]).toBeDefined()
150
- expect(args["coverage"]).toBe(window.__coverage__)
151
-
152
- it "tells Teaspoon that we're finished", ->
153
- @reporter.reportRunnerResults()
154
- expect(Teaspoon.finished).toEqual(true)
155
- Teaspoon.finished = false
156
-
157
-
158
- describe "#log", ->
159
-
160
- it "logs the JSON of the object passed (with an additional _teaspoon property)", ->
161
- @reporter.log(foo: true)
162
- expect(@logSpy).toHaveBeenCalledWith('{"foo":true,"_teaspoon":true}')
@@ -1,88 +0,0 @@
1
- describe "Teaspoon.Reporters.BaseView", ->
2
-
3
- beforeEach ->
4
- @base = new Teaspoon.Reporters.BaseView()
5
-
6
- describe "constructor", ->
7
-
8
- it "calls build", ->
9
- spy = spyOn(Teaspoon.Reporters.BaseView.prototype, "build")
10
- new Teaspoon.Reporters.BaseView()
11
- expect(spy).toHaveBeenCalled()
12
-
13
-
14
- describe "#build", ->
15
-
16
- it "builds an element", ->
17
- @base.build("foo")
18
- expect(@base.el.className).toBe("foo")
19
-
20
-
21
- describe "#appendTo", ->
22
-
23
- it "calls appendChild on the passed element", ->
24
- el = {appendChild: ->}
25
- spy = spyOn(el, "appendChild")
26
- @base.appendTo(el)
27
- expect(spy).toHaveBeenCalledWith(@base.el)
28
-
29
-
30
- describe "#append", ->
31
-
32
- it "calls appendChild on our element", ->
33
- @base.el = {appendChild: ->}
34
- spy = spyOn(@base.el, "appendChild")
35
- otherEl = {}
36
- @base.append(otherEl)
37
- expect(spy).toHaveBeenCalledWith(otherEl)
38
-
39
-
40
- describe "#createEl", ->
41
-
42
- it "creates an element with a className", ->
43
- el = @base.createEl("em", "foo")
44
- expect(el.tagName).toBe("EM")
45
- expect(el.className).toBe("foo")
46
-
47
-
48
- describe "#findEl", ->
49
-
50
- it "finds an element and momoizes it", ->
51
- @base.findEl("controls")
52
- expect(@base.elements["controls"]).toBeDefined()
53
-
54
-
55
- describe "#setText", ->
56
-
57
- it "finds an el and sets it's innerText", ->
58
- el = {innerHTML: "bar"}
59
- spy = spyOn(@base, "findEl").andReturn(el)
60
- @base.setText("foo-id", "foo")
61
- expect(spy).toHaveBeenCalledWith("foo-id")
62
- expect(el.innerHTML).toBe("foo")
63
-
64
-
65
- describe "#setHtml", ->
66
-
67
- it "finds an el and sets it's innerHTML", ->
68
- el = {innerHTML: "bar"}
69
- spy = spyOn(@base, "findEl").andReturn(el)
70
- @base.setHtml("foo-id", "foo")
71
- expect(spy).toHaveBeenCalledWith("foo-id")
72
- expect(el.innerHTML).toBe("foo")
73
-
74
-
75
- describe "#setClass", ->
76
-
77
- it "finds an el and sets a class on it", ->
78
- el = {className: "bar"}
79
- spy = spyOn(@base, "findEl").andReturn(el)
80
- @base.setClass("foo-id", "foo")
81
- expect(spy).toHaveBeenCalledWith("foo-id")
82
- expect(el.className).toBe("foo")
83
-
84
-
85
- describe "#htmlSafe", ->
86
-
87
- it "makes a string html safe", ->
88
- expect(@base.htmlSafe("<div></div>")).toEqual("&lt;div&gt;&lt;/div&gt;")
@@ -1,28 +0,0 @@
1
- describe "Teaspoon.Reporters.HTML.FailureView", ->
2
-
3
- describe "constructor", ->
4
-
5
- it "assigns @spec", ->
6
- spec = {foo: "bar"}
7
- spyOn(Teaspoon.Reporters.HTML.FailureView.prototype, 'build')
8
- subject = new Teaspoon.Reporters.HTML.FailureView(spec)
9
- expect(subject.spec).toBe(spec)
10
-
11
-
12
- describe "#build", ->
13
-
14
- beforeEach ->
15
- @mockSpec =
16
- link: "_link_",
17
- fullDescription: "_full_description_"
18
- errors: ->
19
- [{message: "_error_message_", stack: "_error_stack_"}]
20
- @subject = new Teaspoon.Reporters.HTML.FailureView(@mockSpec)
21
- @subject.build()
22
-
23
- it "builds the html", ->
24
- content = @subject.el.innerHTML
25
- expect(content).toContain('href="_link_"')
26
- expect(content).toContain('_full_description_')
27
- expect(content).toContain("<strong>_error_message_</strong>")
28
- expect(content).toContain("_error_stack_")
@@ -1 +0,0 @@
1
- describe "Teaspoon.Reporters.HTML.ProgressView", ->
@@ -1 +0,0 @@
1
- describe "Teaspoon.Reporters.HTML.SpecView", ->
@@ -1 +0,0 @@
1
- describe "Teaspoon.Reporters.HTML.SuiteView", ->
@@ -1,372 +0,0 @@
1
- describe "Teaspoon.Reporters.HTML", ->
2
-
3
- beforeEach ->
4
- @originalParams = Teaspoon.params
5
- @buildSpy = spyOn(Teaspoon.Reporters.HTML.prototype, "build")
6
- @readConfigSpy = spyOn(Teaspoon.Reporters.HTML.prototype, "readConfig")
7
- Teaspoon.params = grep: "foo"
8
- @reporter = new Teaspoon.Reporters.HTML()
9
- @jasmineSuite = {getFullName: -> "_full jasmine suite description_"}
10
- @jasmineSpecResultsItems = [
11
- {message: "_jasmine_message1_", trace: {stack: "_jasmine_stack_trace1_"}, passed: -> false}
12
- {message: "_jasmine_message2_", trace: {stack: "_jasmine_stack_trace2_"}, passed: -> false}
13
- ]
14
- @jasmineSpecResults =
15
- skipped: false
16
- passed: -> true
17
- getItems: => @jasmineSpecResultsItems
18
- @jasmineSpec =
19
- description: "_jasmine_description_"
20
- viewId: 42
21
- pending: false
22
- suite: @jasmineSuite
23
- getFullName: -> "_full jasmine description_"
24
- results: => @jasmineSpecResults
25
-
26
- afterEach ->
27
- Teaspoon.params = @originalParams
28
-
29
- describe "constructor", ->
30
-
31
- it "sets up the expected variables", ->
32
- expect(@reporter.start).toBeDefined()
33
- expect(@reporter.config).toEqual("use-catch": true, "build-full-report": false, "display-progress": true)
34
- expect(@reporter.total).toEqual({exist: 0, run: 0, passes: 0, failures: 0, skipped: 0})
35
- expect(@reporter.views).toEqual({specs: {}, suites: {}})
36
- expect(@reporter.filters).toEqual(["by match: foo"])
37
-
38
- it "calls readConfig", ->
39
- expect(@readConfigSpy).toHaveBeenCalled()
40
-
41
-
42
- describe "#build", ->
43
-
44
- beforeEach ->
45
- @el = {}
46
- @buildSpy.andCallThrough()
47
- @buildLayoutSpy = spyOn(@reporter, "buildLayout")
48
- @findElSpy = spyOn(@reporter, "findEl").andReturn(@el)
49
- @setTextSpy = spyOn(@reporter, "setText")
50
- @showConfigurationSpy = spyOn(@reporter, "showConfiguration")
51
- @buildProgressSpy = spyOn(@reporter, "buildProgress")
52
- @buildSuiteSelectSpy = spyOn(@reporter, "buildSuiteSelect")
53
- @buildFiltersSpy = spyOn(@reporter, "buildFilters")
54
- spyOn(@reporter, "envInfo").andReturn("library 1.0.0")
55
- @reporter.build()
56
-
57
- it "calls buildLayout", ->
58
- expect(@buildLayoutSpy).toHaveBeenCalled()
59
-
60
- it "finds the element and assigns it", ->
61
- expect(@findElSpy).toHaveBeenCalledWith("report-all")
62
- expect(@reporter.el).toBe(@el)
63
-
64
- it "sets the env-info and version", ->
65
- expect(@setTextSpy).toHaveBeenCalledWith("env-info", "library 1.0.0")
66
- expect(@setTextSpy).toHaveBeenCalledWith("version", Teaspoon.version)
67
-
68
- it "makes the toggles clickable", ->
69
- expect(@findElSpy).toHaveBeenCalledWith("toggles")
70
- expect(@el.onclick).toBe(@reporter.toggleConfig)
71
-
72
- it "calls showConfiguration", ->
73
- expect(@showConfigurationSpy).toHaveBeenCalled()
74
-
75
- it "calls buildProgress", ->
76
- expect(@buildProgressSpy).toHaveBeenCalled()
77
-
78
- it "calls buildSuiteSelect", ->
79
- expect(@buildSuiteSelectSpy).toHaveBeenCalled()
80
-
81
- it "calls buildFilters", ->
82
- expect(@buildFiltersSpy).toHaveBeenCalled()
83
-
84
-
85
- describe "#buildLayout", ->
86
-
87
- beforeEach ->
88
- @el = {}
89
- @createElSpy = spyOn(@reporter, "createEl").andReturn(@el)
90
- @appendChildSpy = spyOn(document.body, "appendChild")
91
- @reporter.buildLayout()
92
-
93
-
94
- it "creates an element and appends it to the body", ->
95
- expect(@createElSpy).toHaveBeenCalledWith("div")
96
- expect(@appendChildSpy).toHaveBeenCalledWith(@el)
97
- expect(@el.innerHTML).toContain("Teaspoon")
98
-
99
-
100
- describe "#buildSuiteSelect", ->
101
-
102
- beforeEach ->
103
- @originalSuites = Teaspoon.suites
104
- Teaspoon.suites = {all: ["default", "foo", "bar"], active: "foo"}
105
-
106
- afterEach ->
107
- Teaspoon.suites = @originalSuites
108
-
109
- it "builds a select that displays the suites", ->
110
- result = @reporter.buildSuiteSelect()
111
- expect(result).toContain("select id=")
112
- expect(result).toContain("selected value=\"#{Teaspoon.root}/foo\"")
113
-
114
-
115
- describe "#buildProgress", ->
116
-
117
- beforeEach ->
118
- @progress = {appendTo: ->}
119
- @findElSpy = spyOn(@reporter, "findEl").andReturn("_element_")
120
- @createSpy = spyOn(Teaspoon.Reporters.HTML.ProgressView, "create").andReturn(@progress)
121
- @appendToSpy = spyOn(@progress, "appendTo")
122
- @reporter.buildProgress()
123
-
124
- it "calls create on ProgressView", ->
125
- expect(@createSpy).toHaveBeenCalledWith(true)
126
-
127
- it "appends the progress element to the dom", ->
128
- expect(@appendToSpy).toHaveBeenCalledWith("_element_")
129
-
130
-
131
- describe "#reportRunnerStarting", ->
132
-
133
- beforeEach ->
134
- @setTextSpy = spyOn(@reporter, "setText")
135
- @reporter.reportRunnerStarting(total: 42)
136
-
137
- it "gets the totals", ->
138
- expect(@reporter.total.exist).toBe(42)
139
-
140
- it "sets the duration text", ->
141
- expect(@setTextSpy).toHaveBeenCalledWith("stats-duration", "...")
142
-
143
-
144
- describe "#reportSpecStarting", ->
145
-
146
- it "creates a SpecView", ->
147
- @reporter.config["build-full-report"] = true
148
- spy = spyOn(Teaspoon.Reporters.HTML, "SpecView")
149
- @reporter.reportSpecStarting(@jasmineSpec)
150
- expect(spy).toHaveBeenCalled()
151
-
152
- it "doesn't create the SpecView if we're not building the full report", ->
153
- @reporter.config["build-full-report"] = false
154
- spy = spyOn(Teaspoon.Reporters.HTML, "SpecView")
155
- @reporter.reportSpecStarting(@jasmineSpec)
156
- expect(spy).wasNotCalled()
157
-
158
- it "tracks the start time of the spec", ->
159
- @reporter.specStart = undefined
160
- @reporter.reportSpecStarting(@jasmineSpec)
161
- expect(@reporter.specStart).toBeDefined()
162
-
163
-
164
- describe "#reportSpecResults", ->
165
-
166
- beforeEach ->
167
- @updateProgressSpy = spyOn(@reporter, "updateProgress")
168
- @updateStatusSpy = spyOn(@reporter, "updateStatus")
169
-
170
- it "increases the total run count", ->
171
- @reporter.total.run = 41
172
- @reporter.reportSpecResults(@jasmineSpec)
173
- expect(@reporter.total.run).toBe(42)
174
-
175
- it "calls updateProgress", ->
176
- @reporter.reportSpecResults(@jasmineSpec)
177
- expect(@updateProgressSpy).toHaveBeenCalled()
178
-
179
- it "calls updateStatus", ->
180
- @reporter.reportSpecResults(@jasmineSpec)
181
- expect(@updateStatusSpy).toHaveBeenCalledWith(@jasmineSpec)
182
-
183
-
184
- describe "#reportRunnerResults", ->
185
-
186
- beforeEach ->
187
- @setTextSpy = spyOn(@reporter, "setText")
188
- @setStatusSpy = spyOn(@reporter, "setStatus")
189
- @updateProgressSpy = spyOn(@reporter, "updateProgress")
190
- @elapsedTimeSpy = spyOn(@reporter, "elapsedTime").andReturn("1.000s")
191
- @reporter.total = {run: 666, exist: 42, failures: 5, passes: 10, skipped: 15}
192
-
193
- it "does nothing if there were no tests run", ->
194
- @reporter.total.run = 0
195
- @reporter.reportRunnerResults()
196
- expect(@setTextSpy).wasNotCalled()
197
-
198
- it "sets the duration text", ->
199
- @reporter.total = {run: 666, exist: 42}
200
- @reporter.reportRunnerResults()
201
- expect(@setTextSpy).toHaveBeenCalledWith("stats-duration", "1.000s")
202
-
203
- it "sets the status to passed if there are no failures", ->
204
- @reporter.total.failures = 0
205
- @reporter.reportRunnerResults()
206
- expect(@setStatusSpy).toHaveBeenCalledWith("passed")
207
-
208
- it "displays the total passes", ->
209
- @reporter.reportRunnerResults()
210
- expect(@setTextSpy).toHaveBeenCalledWith("stats-passes", 10)
211
-
212
- it "displays the total failures", ->
213
- @reporter.reportRunnerResults()
214
- expect(@setTextSpy).toHaveBeenCalledWith("stats-failures", 5)
215
-
216
- it "displays the total skipped", ->
217
- @reporter.reportRunnerResults()
218
- expect(@setTextSpy).toHaveBeenCalledWith("stats-skipped", 15)
219
-
220
- it "calls updateProgress", ->
221
- @reporter.reportRunnerResults()
222
- expect(@updateProgressSpy).toHaveBeenCalled()
223
-
224
-
225
- describe "#updateStat", ->
226
-
227
- beforeEach ->
228
- @setTextSpy = spyOn(@reporter, "setText")
229
-
230
- it "does nothing if we're not displaying progress", ->
231
- @reporter.config["display-progress"] = false
232
- @reporter.updateStat("name", 42)
233
- expect(@setTextSpy).wasNotCalled()
234
-
235
-
236
- it "sets the text of the stat we want to set", ->
237
- @reporter.updateStat("name", 42)
238
- expect(@setTextSpy).toHaveBeenCalledWith("stats-name", 42)
239
-
240
-
241
- describe "#updateStatus", ->
242
-
243
- beforeEach ->
244
- @updateStatSpy = spyOn(@reporter, "updateStat")
245
- @setStatusSpy = spyOn(@reporter, "setStatus")
246
- @findElSpy = spyOn(@reporter, "findEl").andReturn(appendChild: ->)
247
-
248
- describe "skipped", ->
249
-
250
- it "updates the statistic", ->
251
- @jasmineSpecResults.skipped = true
252
- @reporter.updateStatus(@jasmineSpec)
253
- expect(@updateStatSpy).toHaveBeenCalledWith("skipped", 1)
254
-
255
- describe "pass", ->
256
-
257
- it "updates the statistic", ->
258
- @reporter.updateStatus(@jasmineSpec)
259
- expect(@updateStatSpy).toHaveBeenCalledWith("passes", 1)
260
-
261
- it "calls updateState on the view", ->
262
- @reporter.reportView = updateState: ->
263
- spy = spyOn(@reporter.reportView, "updateState")
264
- @reporter.updateStatus(@jasmineSpec)
265
- expect(spy.argsForCall[0][0]).toBe("passed")
266
-
267
- describe "failure", ->
268
-
269
- beforeEach ->
270
- @jasmineSpecResults.passed = -> false
271
-
272
- it "updates the statistic", ->
273
- @reporter.updateStatus(@jasmineSpec)
274
- expect(@updateStatSpy).toHaveBeenCalledWith("failures", 1)
275
-
276
- it "calls updateState on the view", ->
277
- @reporter.reportView = updateState: ->
278
- spy = spyOn(@reporter.reportView, "updateState")
279
- @reporter.updateStatus(@jasmineSpec)
280
- expect(spy.argsForCall[0][0]).toBe("failed")
281
-
282
- it "creates a FailureView and appends it to the dom", ->
283
- spy = spyOn(Teaspoon.Reporters.HTML, "FailureView").andReturn(appendTo: ->)
284
- @reporter.updateStatus(@jasmineSpec)
285
- expect(spy).toHaveBeenCalled()
286
-
287
- it "doesn't create a FailureView if we're building the full report", ->
288
- @reporter.config["build-full-report"] = true
289
- spy = spyOn(Teaspoon.Reporters.HTML, "FailureView").andReturn(appendTo: ->)
290
- @reporter.updateStatus(@jasmineSpec)
291
- expect(spy).wasNotCalled()
292
-
293
- it "sets the status", ->
294
- @reporter.updateStatus(@jasmineSpec)
295
- expect(@setStatusSpy).toHaveBeenCalledWith("failed")
296
-
297
-
298
- describe "#updateProgress", ->
299
-
300
- beforeEach ->
301
- @progress = {update: ->}
302
- @updateSpy = spyOn(@progress, "update")
303
- @reporter.progress = @progress
304
- @reporter.total = {exist: 666, run: 42}
305
- @reporter.updateProgress()
306
-
307
- it "calls update on the progress view", ->
308
- expect(@updateSpy).toHaveBeenCalledWith(666, 42)
309
-
310
-
311
- describe "#showConfiguration", ->
312
-
313
- beforeEach ->
314
- @setClassSpy = spyOn(@reporter, "setClass")
315
-
316
- it "sets the class to active on the toggle buttons for each configuration", ->
317
- @reporter.showConfiguration()
318
- expect(@setClassSpy).toHaveBeenCalledWith("use-catch", "active")
319
- expect(@setClassSpy).toHaveBeenCalledWith("build-full-report", "")
320
- expect(@setClassSpy).toHaveBeenCalledWith("display-progress", "active")
321
-
322
-
323
- describe "#setStatus", ->
324
-
325
- it "sets the body class to the status passed in", ->
326
- current = document.body.className
327
- @reporter.setStatus("foo")
328
- expect(document.body.className).toBe("teaspoon-foo")
329
- document.body.className = current
330
-
331
-
332
- describe "#setFilter", ->
333
-
334
- beforeEach ->
335
- Teaspoon.params = grep: "_grep_", file: "_file_"
336
- @reporter.filters = []
337
- @reporter.setFilters()
338
-
339
- it "sets a class and the html for the filter display", ->
340
- expect(@reporter.filters.length).toBe(2)
341
- expect(@reporter.filters[0]).toBe("by file: _file_")
342
- expect(@reporter.filters[1]).toBe("by match: _grep_")
343
-
344
-
345
- describe "#readConfig", ->
346
-
347
- beforeEach ->
348
- @readConfigSpy.andCallThrough()
349
- @config = {}
350
- @storeSpy = spyOn(@reporter, "store").andReturn(@config)
351
- @reporter.readConfig()
352
-
353
- it "reads the configuration from the cookie", ->
354
- expect(@storeSpy).toHaveBeenCalledWith("teaspoon")
355
- expect(@reporter.config).toEqual(@config)
356
-
357
-
358
- describe "#toggleConfig", ->
359
-
360
- beforeEach ->
361
- @refreshSpy = spyOn(Teaspoon, "reload")
362
- @storeSpy = spyOn(@reporter, "store")
363
- @reporter.toggleConfig(target: {tagName: "button", getAttribute: -> "teaspoon-use-catch"})
364
-
365
- it "toggles the configuration", ->
366
- expect(@reporter.config["use-catch"]).toBe(false)
367
-
368
- it "sets the cookie", ->
369
- expect(@storeSpy).toHaveBeenCalledWith("teaspoon", @reporter.config)
370
-
371
- it "refreshes the page", ->
372
- expect(@refreshSpy).toHaveBeenCalled()