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,58 +0,0 @@
1
- describe "Teaspoon.Runner", ->
2
-
3
- beforeEach ->
4
- spyOn(jasmine.getEnv(), "execute")
5
- Teaspoon.Runner.run = false # reset this so we can use it
6
- @setupSpy = spyOn(Teaspoon.Runner.prototype, "setup")
7
-
8
- describe "constructor", ->
9
-
10
- it "calls setup", ->
11
- new Teaspoon.Runner()
12
- expect(@setupSpy).toHaveBeenCalled()
13
-
14
- it "sets Teaspoon.Runner.run to true", ->
15
- new Teaspoon.Runner()
16
- expect(Teaspoon.Runner.run).toEqual(true)
17
-
18
- it "sets @fixturePath to whatever was in Teaspoon.root", ->
19
- originalRoot = Teaspoon.root
20
- Teaspoon.root = "/path/to"
21
- runner = new Teaspoon.Runner()
22
- expect(runner.fixturePath).toEqual("/path/to/fixtures")
23
- Teaspoon.root = originalRoot
24
-
25
- it "doesn't call setup if already run", ->
26
- Teaspoon.Runner.run = true
27
- new Teaspoon.Runner()
28
- expect(@setupSpy).wasNotCalled()
29
-
30
-
31
- describe "#getParams", ->
32
-
33
- it "gets the params out of the window.location.search", ->
34
- spyOn(String.prototype, "substring").andReturn("grep=foo&bar=baz")
35
- runner = new Teaspoon.Runner()
36
- expect(runner.params).toEqual(grep: "foo", bar: "baz")
37
-
38
-
39
- describe "#getReporter", ->
40
-
41
- it "returns the correct reporter when using PhantomJS", ->
42
- runner = new Teaspoon.Runner()
43
- runner.params = {}
44
- spyOn(String.prototype, 'match').andReturn(20)
45
- expect(runner.getReporter()).toBe(Teaspoon.Reporters.Console)
46
-
47
- it "returns the correct reporter when using the browser", ->
48
- runner = new Teaspoon.Runner()
49
- runner.params = {}
50
- spyOn(String.prototype, 'match').andReturn(0)
51
- expect(runner.getReporter()).toBe(Teaspoon.Reporters.HTML)
52
-
53
- it "allows setting the param", ->
54
- runner = new Teaspoon.Runner()
55
- runner.params = {reporter: "Console"}
56
- expect(runner.getReporter()).toBe(Teaspoon.Reporters.Console)
57
- runner.params = {reporter: "HTML"}
58
- expect(runner.getReporter()).toBe(Teaspoon.Reporters.HTML)
@@ -1,47 +0,0 @@
1
- describe "Teaspoon", ->
2
-
3
- describe "class level API", ->
4
-
5
- it "has the expected API", ->
6
- return unless Object.keys # can't test in ie
7
- keys = Object.keys(Teaspoon)
8
- # common
9
- expect(keys).toContain("defer")
10
- expect(keys).toContain("slow")
11
- expect(keys).toContain("root")
12
- expect(keys).toContain("finished")
13
- expect(keys).toContain("execute")
14
- expect(keys).toContain("version")
15
- # caching
16
- expect(keys).toContain("Date")
17
- expect(keys).toContain("location")
18
-
19
-
20
- describe ".execute", ->
21
-
22
- beforeEach ->
23
- Teaspoon.defer = false
24
- spyOn(Teaspoon, 'reload')
25
- @spy = spyOn(Teaspoon, "Runner")
26
-
27
- it "allows deferring (thus not instantiating the runner)", ->
28
- Teaspoon.defer = true
29
- Teaspoon.execute()
30
- expect(@spy).wasNotCalled()
31
-
32
- it "will execute if it should", ->
33
- Teaspoon.execute()
34
- expect(@spy).toHaveBeenCalled()
35
-
36
-
37
- describe ".hook", ->
38
-
39
- beforeEach ->
40
- @xhr = jasmine.createSpyObj("xhr", ["open", "setRequestHeader", "send"])
41
- spyOn(window, "XMLHttpRequest").andReturn(@xhr)
42
-
43
- it "makes the proper ajax request", ->
44
- Teaspoon.hook("foo", {bar: "baz"})
45
- expect(@xhr.open).toHaveBeenCalledWith("POST", "/teaspoon/default/foo", false)
46
- expect(@xhr.setRequestHeader).toHaveBeenCalledWith("Content-Type", "application/json")
47
- expect(@xhr.send).toHaveBeenCalledWith('{"args":{"bar":"baz"}}')
@@ -1,13 +0,0 @@
1
- fixture.preload("fixture.html", "fixture.json") # make the actual requests for the files
2
- describe "Using fixtures", ->
3
-
4
- fixture.set("<h2>Another Title</h2>") # create some markup manually (will be in a beforeEach)
5
-
6
- beforeEach ->
7
- @fixtures = fixture.load("fixture.html", "fixture.json", true) # append these fixtures
8
-
9
- it "loads fixtures", ->
10
- expect($("h1", fixture.el).text()).toBe("Title") # using fixture.el as a jquery scope
11
- expect($("h2", fixture.el).text()).toBe("Another Title")
12
- expect(@fixtures[0]).toBe(fixture.el) # the element is available as a return value and through fixture.el
13
- expect(@fixtures[1]).toEqual(fixture.json[0]) # the json for json fixtures is returned, and available in fixture.json
@@ -1,101 +0,0 @@
1
- describe "Jasmine Teaspoon.Spec", ->
2
-
3
- beforeEach ->
4
- @mockSuite =
5
- getFullName: -> "_full jasmine name_"
6
- @mockSpecResultsItems = [
7
- {message: "_jasmine_message1_", trace: {stack: "_jasmine_stack_trace1_"}, passed: -> false}
8
- {message: "_jasmine_message2_", trace: {stack: "_jasmine_stack_trace2_"}, passed: -> false}
9
- ]
10
- @mockSpecResults =
11
- skipped: false
12
- passed: -> true
13
- getItems: => @mockSpecResultsItems
14
- @mockSpec =
15
- description: "_jasmine_description_"
16
- viewId: 42
17
- pending: false
18
- suite: @mockSuite
19
- getFullName: -> "_full jasmine description_"
20
- results: => @mockSpecResults
21
-
22
- describe "constructor", ->
23
-
24
- it "has the expected properties", ->
25
- spec = new Teaspoon.Spec(@mockSpec)
26
- expect(spec.fullDescription).toBe("_full jasmine description_")
27
- expect(spec.description).toBe("_jasmine_description_")
28
- expect(spec.link).toBe("?grep=_full%20jasmine%20description_")
29
- expect(spec.parent).toBe(@mockSuite)
30
- expect(spec.suiteName).toBe("_full jasmine name_")
31
- expect(spec.viewId).toBe(42)
32
- expect(spec.pending).toBe(false)
33
-
34
-
35
- describe "#errors", ->
36
-
37
- it "returns the expected object", ->
38
- spec = new Teaspoon.Spec(@mockSpec)
39
- expect(spec.errors()).toEqual([{message: "_jasmine_message1_", stack: "_jasmine_stack_trace1_"}, {message: "_jasmine_message2_", stack: "_jasmine_stack_trace2_"}])
40
- spyOn(@mockSpecResultsItems[0], "passed").andReturn(true)
41
- spec = new Teaspoon.Spec(@mockSpec)
42
- expect(spec.errors()).toEqual([{message: "_jasmine_message2_", stack: "_jasmine_stack_trace2_"}])
43
-
44
-
45
- describe "#getParents", ->
46
-
47
- it "gets the parent suites", ->
48
- spec = new Teaspoon.Spec(@mockSpec)
49
- expect(spec.getParents()[0].fullDescription).toEqual("_full jasmine name_")
50
-
51
-
52
- describe "#result", ->
53
-
54
- describe "passing", ->
55
-
56
- it "returns the expected object", ->
57
- spec = new Teaspoon.Spec(@mockSpec)
58
- expect(spec.result()).toEqual({status: "passed", skipped: false})
59
-
60
- describe "skipped", ->
61
-
62
- it "returns the expected object", ->
63
- @mockSpecResults.skipped = true
64
- spec = new Teaspoon.Spec(@mockSpec)
65
- expect(spec.result()).toEqual({status: "passed", skipped: true})
66
-
67
- describe "pending", ->
68
-
69
- it "returns the expected object", ->
70
- @mockSpec.pending = true
71
- spec = new Teaspoon.Spec(@mockSpec)
72
- expect(spec.result()).toEqual({status: "pending", skipped: false})
73
-
74
- describe "failing", ->
75
-
76
- it "returns the expected object", ->
77
- spyOn(@mockSpecResults, "passed").andReturn(false)
78
- spec = new Teaspoon.Spec(@mockSpec)
79
- expect(spec.result()).toEqual({status: "failed", skipped: false})
80
-
81
-
82
-
83
- describe "Jasmine Teaspoon.Suite", ->
84
-
85
- beforeEach ->
86
- @mockParentSuite = {}
87
- @mockSuite =
88
- description: "_jasmine_description_"
89
- parentSuite: @mockParentSuite
90
- viewId: 42
91
- getFullName: -> "_full jasmine description_"
92
-
93
- describe "constructor", ->
94
-
95
- it "has the expected properties", ->
96
- suite = new Teaspoon.Suite(@mockSuite)
97
- expect(suite.fullDescription).toBe("_full jasmine description_")
98
- expect(suite.description).toBe("_jasmine_description_")
99
- expect(suite.link).toBe("?grep=_full%20jasmine%20description_")
100
- expect(suite.parent).toBe(@mockParentSuite)
101
- expect(suite.viewId).toBe(42)
@@ -1,17 +0,0 @@
1
- describe "Jasmine Teaspoon.Reporters.HTML", ->
2
-
3
- beforeEach ->
4
- spyOn(Teaspoon.Reporters.HTML.prototype, "build")
5
- @reporter = new Teaspoon.Reporters.HTML()
6
-
7
- describe "#readConfig", ->
8
-
9
- it "sets jasmine.CATCH_EXCEPTIONS", ->
10
- @reporter.readConfig()
11
- expect(jasmine.CATCH_EXCEPTIONS).toBe(@reporter.config["use-catch"])
12
-
13
-
14
- describe "#envInfo", ->
15
-
16
- it "returns jasmine version information", ->
17
- expect(@reporter.envInfo()).toBe("jasmine 1.3.1 revision 1354556913")
@@ -1,59 +0,0 @@
1
- describe "Jasmine Teaspoon.Runner", ->
2
-
3
- beforeEach ->
4
- @env = jasmine.getEnv()
5
- @originalFilter = @env.specFilter
6
- @executeSpy = spyOn(@env, "execute")
7
- @runner = new Teaspoon.Runner()
8
-
9
- afterEach ->
10
- @env.specFilter = @originalFilter
11
-
12
- describe "constructor", ->
13
-
14
- it "calls execute on the jasmine env", ->
15
- expect(@executeSpy).toHaveBeenCalled()
16
-
17
-
18
- describe "#setup", ->
19
-
20
- beforeEach ->
21
- @runner.params = {grep: "foo"}
22
- if window.navigator.userAgent.match(/PhantomJS/)
23
- @reporterSpy = spyOn(Teaspoon.Reporters, "Console").andReturn(@instance)
24
- else
25
- @reporterSpy = spyOn(Teaspoon.Reporters, "HTML").andReturn(@instance)
26
- @addReporterSpy = spyOn(@env, "addReporter")
27
-
28
- it "sets the updateInterval", ->
29
- expect(@env.updateInterval).toEqual(1000)
30
-
31
- it "adds the reporter to the env", ->
32
- @runner.setup()
33
- expect(@reporterSpy).toHaveBeenCalled()
34
- expect(@addReporterSpy).toHaveBeenCalled()
35
-
36
- it "adds fixture support", ->
37
- spy = spyOn(@runner, "addFixtureSupport")
38
- @runner.setup()
39
- expect(spy).toHaveBeenCalled()
40
-
41
-
42
- describe "#addFixtureSupport", ->
43
-
44
- beforeEach ->
45
- @fixtureObj = {cleanUp: ->}
46
- @styleFixtureObj = {cleanUp: ->}
47
- @jsonFixtureSpyObj = {cleanUp: ->}
48
- @fixtureSpy = spyOn(jasmine, "getFixtures").andReturn(@fixtureObj)
49
- @styleFixtureSpy = spyOn(jasmine, "getStyleFixtures").andReturn(@styleFixtureObj)
50
- @jsonFixtureSpy = spyOn(jasmine, "getJSONFixtures").andReturn(@jsonFixtureSpyObj)
51
-
52
- it "adds fixture support", ->
53
- expect(jasmine.getFixtures).toBeDefined()
54
- @runner.fixturePath = "/path/to/fixtures"
55
- @runner.addFixtureSupport()
56
- expect(@fixtureObj.containerId).toBe("teaspoon-fixtures")
57
- expect(@fixtureObj.fixturesPath).toBe("/path/to/fixtures")
58
- expect(@styleFixtureObj.fixturesPath).toBe("/path/to/fixtures")
59
- expect(@jsonFixtureSpyObj.fixturesPath).toBe("/path/to/fixtures")
@@ -1,3 +0,0 @@
1
- describe "Teaspoon running Jasmine", ->
2
-
3
- it "allows pending specs"
@@ -1,12 +0,0 @@
1
- fixture.preload("fixture.html", "fixture.json") # make the actual requests for the files
2
- describe "Using fixtures", ->
3
-
4
- fixture.set("<h2>Another Title</h2>") # create some markup manually (will be in a beforeEach)
5
-
6
- beforeEach ->
7
- @fixtures = fixture.load("fixture.html", "fixture.json", true) # append these fixtures
8
-
9
- it "loads fixtures", ->
10
- expect(document.getElementById("fixture_view").tagName).to.be("DIV")
11
- expect(@fixtures[0]).to.be(fixture.el) # the element is available as a return value and through fixture.el
12
- expect(@fixtures[1]).to.eql(fixture.json[0]) # the json for json fixtures is returned, and available in fixture.json
@@ -1,93 +0,0 @@
1
- describe "Mocha Teaspoon.Spec", ->
2
-
3
- beforeEach ->
4
- @mockSuite =
5
- fullTitle: -> "_full mocha name_"
6
- parent:
7
- root: true
8
- @mockSpec =
9
- title: "_mocha_description_"
10
- parent: @mockSuite
11
- viewId: 420
12
- pending: false
13
- state: "passed"
14
- err: {message: "_mocha_message_", stack: "_mocha_stack_trace_"}
15
- fullTitle: -> "_full mocha description_"
16
-
17
- describe "constructor", ->
18
-
19
- it "has the expected properties", ->
20
- spec = new Teaspoon.Spec(@mockSpec)
21
- expect(spec.fullDescription).to.be("_full mocha description_")
22
- expect(spec.description).to.be("_mocha_description_")
23
- expect(spec.link).to.be("?grep=_full%20mocha%20description_")
24
- expect(spec.parent).to.be(@mockSuite)
25
- expect(spec.suiteName).to.be("_full mocha name_")
26
- expect(spec.viewId).to.be(420)
27
- expect(spec.pending).to.be(false)
28
-
29
-
30
- describe "#errors", ->
31
-
32
- it "returns the expected object", ->
33
- spec = new Teaspoon.Spec(@mockSpec)
34
- expect(spec.errors()).to.eql([{message: "_mocha_message_", stack: "_mocha_stack_trace_"}])
35
-
36
-
37
- describe "#getParents", ->
38
-
39
- it "gets the parent suites", ->
40
- spec = new Teaspoon.Spec(@mockSpec)
41
- expect(spec.getParents()[0].fullDescription).to.be("_full mocha name_")
42
-
43
-
44
- describe "#result", ->
45
-
46
- describe "passing", ->
47
-
48
- it "returns the expected object", ->
49
- spec = new Teaspoon.Spec(@mockSpec)
50
- expect(spec.result()).to.eql({status: "passed", skipped: false})
51
-
52
- describe "skipped", ->
53
-
54
- it "returns the expected object", ->
55
- @mockSpec.state = "skipped"
56
- spec = new Teaspoon.Spec(@mockSpec)
57
- expect(spec.result()).to.eql({status: "passed", skipped: true})
58
-
59
- describe "pending", ->
60
-
61
- it "returns the expected object", ->
62
- @mockSpec.pending = true
63
- spec = new Teaspoon.Spec(@mockSpec)
64
- expect(spec.result()).to.eql({status: "pending", skipped: false})
65
-
66
- describe "failing", ->
67
-
68
- it "returns the expected object", ->
69
- @mockSpec.state = "failed"
70
- spec = new Teaspoon.Spec(@mockSpec)
71
- expect(spec.result()).to.eql({status: "failed", skipped: false})
72
-
73
-
74
-
75
- describe "Mocha Teaspoon.Suite", ->
76
-
77
- beforeEach ->
78
- @mockParentSuite = {root: false}
79
- @mockSuite =
80
- fullTitle: -> "_full mocha description_"
81
- title: "_mocha_description_"
82
- viewId: 420
83
- parent: @mockParentSuite
84
-
85
- describe "constructor", ->
86
-
87
- it "has the expected properties", ->
88
- suite = new Teaspoon.Suite(@mockSuite)
89
- expect(suite.fullDescription).to.be("_full mocha description_")
90
- expect(suite.description).to.be("_mocha_description_")
91
- expect(suite.link).to.be("?grep=_full%20mocha%20description_")
92
- expect(suite.parent).to.be(@mockParentSuite)
93
- expect(suite.viewId).to.be(420)
@@ -1,24 +0,0 @@
1
- describe "Mocha Teaspoon.Reporters.Console", ->
2
-
3
- beforeEach ->
4
- @runner = {on: @onSpy = sinon.spy()}
5
- @reportRunnerStartingSpy = Teaspoon.Reporters.Console.prototype.reportRunnerStarting = sinon.spy()
6
- @reporter = new Teaspoon.Reporters.Console(@runner)
7
-
8
- describe "constructor", ->
9
-
10
- it "calls reporterRunnerStarting", ->
11
- assert.calledOnce(@reportRunnerStartingSpy, "foo")
12
-
13
- it "registers for 'fail', 'test end', and 'end'", ->
14
- assert.calledWith(@onSpy, "fail", @reporter.reportSpecResults)
15
- assert.calledWith(@onSpy, "test end", @reporter.reportSpecResults)
16
- assert.calledWith(@onSpy, "end", @reporter.reportRunnerResults)
17
-
18
-
19
- describe "#reportSpecResults", ->
20
-
21
- it "sets the error if one is passed in", ->
22
- spec = {}
23
- @reporter.reportSpecResults(spec, foo: "bar")
24
- expect(spec.err).to.eql(foo: "bar")
@@ -1,41 +0,0 @@
1
- describe "Mocha Teaspoon.Reporters.HTML", ->
2
-
3
- beforeEach ->
4
- @runner = {on: @onSpy = sinon.spy()}
5
- @superSpy = Teaspoon.Reporters.HTML.__super__.constructor = sinon.spy()
6
- Teaspoon.Reporters.HTML.filter = "foo"
7
- @reportRunnerStartingSpy = Teaspoon.Reporters.HTML.prototype.reportRunnerStarting = sinon.spy()
8
- @reporter = new Teaspoon.Reporters.HTML(@runner)
9
-
10
- describe "constructor", ->
11
-
12
- it "calls reporterRunnerStarting", ->
13
- assert.calledOnce(@reportRunnerStartingSpy, "foo")
14
-
15
- it "registers for 'fail', 'test end', and 'end'", ->
16
- assert.calledWith(@onSpy, "fail", @reporter.reportSpecResults)
17
- assert.calledWith(@onSpy, "test end", @reporter.reportSpecResults)
18
- assert.calledWith(@onSpy, "end", @reporter.reportRunnerResults)
19
-
20
-
21
- describe "#reportSpecResults", ->
22
-
23
- it "sets the error if one is passed in", ->
24
- spec = {}
25
- @reporter.reportSpecResults(spec, foo: "bar")
26
- expect(spec.err).to.eql(foo: "bar")
27
-
28
-
29
- describe "Mocha Teaspoon.Reporters.HTML.SpecView", ->
30
-
31
- describe "#updateState", ->
32
-
33
- it "calls super with the duration of the spec", ->
34
- # this can't be tested, I tried a lot....
35
- #@superSpy = Teaspoon.Reporters.HTML.SpecView.__super__.updateState = sinon.spy()
36
- #@buildSpy = Teaspoon.Reporters.HTML.SpecView.prototype.build = sinon.spy()
37
- #view = new Teaspoon.Reporters.HTML.SpecView({viewId: 1000000}, {views: []})
38
- #view.spec.duration = 1000
39
- #view.updateState("passed")
40
- #assert.calledWith(@superSpy, "passed", 1000)
41
-