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,37 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe Teaspoon::Formatters::CleanFormatter do
4
-
5
- let(:passing_spec) { double(passing?: true) }
6
- let(:pending_spec) { double(passing?: false, pending?: true, description: "_description_") }
7
- let(:failing_spec) { double(passing?: false, pending?: false, description: "_description_", message: "_message_", link: "_link_") }
8
-
9
- before do
10
- @log = ""
11
- allow(STDOUT).to receive(:print) { |s| @log << s }
12
- end
13
-
14
- describe "#result" do
15
-
16
- let(:result) { double(elapsed: 3.1337, coverage: nil) }
17
-
18
- before do
19
- subject.run_count = 666
20
- end
21
-
22
- describe "with failures" do
23
-
24
- before do
25
- subject.failures << failing_spec
26
- end
27
-
28
- it "logs the failures but not the failure commands" do
29
- subject.result(result)
30
- expect(@log).to eq("\n\nFailures:\n\n 1) _description_\n\e[31m Failure/Error: _message_\n\e[0m\nFinished in 3.1337 seconds\n\e[31m666 examples, 1 failure\e[0m\n")
31
- end
32
-
33
- end
34
-
35
- end
36
-
37
- end
@@ -1,127 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe Teaspoon::Formatters::DocumentationFormatter do
4
-
5
- let(:suite) { double(label: "_suite_", level: @level || 0)}
6
- let(:passing_spec) { double(passing?: true, label: "_passing_") }
7
- let(:pending_spec) { double(passing?: false, pending?: true, label: "_pending_", description: "_description_") }
8
- let(:failing_spec) { double(passing?: false, pending?: false, label: "_failing_", description: "_description_", message: "_message_", link: "_link_") }
9
-
10
- before do
11
- @log = ""
12
- allow(STDOUT).to receive(:print) { |s| @log << s }
13
- end
14
-
15
- describe "#suite" do
16
-
17
- it "logs a properly indented suite message" do
18
- @level = 2
19
- subject.suite(suite)
20
- expect(@log).to eq(" _suite_\n")
21
- expect(subject.instance_variable_get(:@level)).to eq(2)
22
- end
23
-
24
- end
25
-
26
- describe "#spec" do
27
-
28
- before do
29
- subject.instance_variable_set(:@level, 1)
30
- subject.instance_variable_set(:@last_suite, {})
31
- subject.instance_variable_set(:@stdout, "line1\nline2\n")
32
- end
33
-
34
- it "logs an indented green label on passing results" do
35
- subject.spec(passing_spec)
36
- expect(@log).to eq("\e[32m _passing_\e[0m\n\e[36m # line1\n # line2\e[0m\n")
37
- end
38
-
39
- it "logs an indented yellow label on pending results" do
40
- subject.instance_variable_set(:@level, 1)
41
- subject.instance_variable_set(:@last_suite, {})
42
- subject.spec(pending_spec)
43
- expect(@log).to eq("\e[33m _pending_ (PENDING)\e[0m\n\e[36m # line1\n # line2\e[0m\n")
44
- end
45
-
46
- it "logs an indented red label (with stdout) on failing results" do
47
- subject.spec(failing_spec)
48
- expect(@log).to eq("\e[31m _failing_ (FAILED - 1)\e[0m\n\e[36m # line1\n # line2\e[0m\n")
49
- end
50
-
51
- end
52
-
53
- describe "#error" do
54
-
55
- let(:result) { double(message: "_message_", trace: [{"file" => "http://127.0.0.1:31337/assets/path/file.js?foo=true&body=1", "line" => 42, "function" => "notAnAnonFunc"}]) }
56
-
57
- it "logs the error" do
58
- subject.error(result)
59
- expect(@log).to eq("\e[31m_message_\e[0m\n\e[36m # path/file.js?foo=true:42 -- notAnAnonFunc\e[0m\n\n")
60
- end
61
-
62
- end
63
-
64
- describe "#result" do
65
-
66
- let(:result) { double(elapsed: 3.1337, coverage: nil) }
67
-
68
- before do
69
- subject.run_count = 666
70
- end
71
-
72
- describe "with no failures" do
73
-
74
- it "logs the stats" do
75
- subject.result(result)
76
- expect(@log).to eq("\nFinished in 3.1337 seconds\n\e[32m666 examples, 0 failures\e[0m\n")
77
- end
78
-
79
- end
80
-
81
- describe "with failures" do
82
-
83
- before do
84
- subject.failures << failing_spec
85
- end
86
-
87
- it "logs the failures" do
88
- subject.result(result)
89
- expect(@log).to eq("\nFailures:\n\n 1) _description_\n\e[31m Failure/Error: _message_\n\e[0m\nFinished in 3.1337 seconds\n\e[31m666 examples, 1 failure\e[0m\n\nFailed examples:\n\n\e[31mteaspoon -s default --filter=\"_link_\"\e[0m\n")
90
- end
91
-
92
- end
93
-
94
- describe "with pending" do
95
-
96
- before do
97
- subject.pendings << pending_spec
98
- end
99
-
100
- it "logs the pending specs" do
101
- subject.result(result)
102
- expect(@log).to eq("\nPending:\n\e[33m _description_\e[0m\n\e[36m # Not yet implemented\n\e[0m\nFinished in 3.1337 seconds\n\e[33m666 examples, 0 failures, 1 pending\e[0m\n")
103
- end
104
-
105
- end
106
-
107
- end
108
-
109
- describe "#coverage" do
110
-
111
- it "logs the coverage" do
112
- subject.coverage("_text_\n\n_text_summary_")
113
- expect(@log).to eq("\n_text_\n\n_text_summary_\n")
114
- end
115
-
116
- end
117
-
118
- describe "#threshold_failure" do
119
-
120
- it "logs the threshold failures" do
121
- subject.threshold_failure("_was_not_met_\n_was_not_met_")
122
- expect(@log).to eq("\e[31m\n_was_not_met_\n_was_not_met_\n\e[0m\n")
123
- end
124
-
125
- end
126
-
127
- end
@@ -1,116 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe Teaspoon::Formatters::DotFormatter do
4
-
5
- let(:passing_spec) { double(passing?: true) }
6
- let(:pending_spec) { double(passing?: false, pending?: true, description: "_description_") }
7
- let(:failing_spec) { double(passing?: false, pending?: false, description: "_description_", message: "_message_", link: "_link_") }
8
-
9
- before do
10
- @log = ""
11
- allow(STDOUT).to receive(:print) { |s| @log << s }
12
- end
13
-
14
- describe "#spec" do
15
-
16
- it "logs a green . on passing results" do
17
- subject.spec(passing_spec)
18
- expect(@log).to eq("\e[32m.\e[0m")
19
- end
20
-
21
- it "logs a yellow * on pending results" do
22
- subject.spec(pending_spec)
23
- expect(@log).to eq("\e[33m*\e[0m")
24
- end
25
-
26
- it "logs a red F on failing results" do
27
- subject.spec(failing_spec)
28
- expect(@log).to eq("\e[31mF\e[0m")
29
- end
30
-
31
- end
32
-
33
- describe "#error" do
34
-
35
- let(:result) { double(message: "_message_", trace: [{"file" => "http://127.0.0.1:31337/assets/path/file.js?foo=true&body=1", "line" => 42, "function" => "notAnAnonFunc"}]) }
36
-
37
- it "logs the error" do
38
- subject.error(result)
39
- expect(@log).to eq("\e[31m_message_\e[0m\n\e[36m # path/file.js?foo=true:42 -- notAnAnonFunc\e[0m\n\n")
40
- end
41
-
42
- end
43
-
44
- describe "#console" do
45
-
46
- it "logs the message" do
47
- subject.console("_message_\n")
48
- expect(@log).to eq("_message_\n")
49
- end
50
-
51
- end
52
-
53
- describe "#result" do
54
-
55
- let(:result) { double(elapsed: 3.1337, coverage: nil) }
56
-
57
- before do
58
- subject.run_count = 666
59
- end
60
-
61
- describe "with no failures" do
62
-
63
- it "logs the stats" do
64
- subject.result(result)
65
- expect(@log).to eq("\n\nFinished in 3.1337 seconds\n\e[32m666 examples, 0 failures\e[0m\n")
66
- end
67
-
68
- end
69
-
70
- describe "with failures" do
71
-
72
- before do
73
- subject.failures << failing_spec
74
- end
75
-
76
- it "logs the failures" do
77
- subject.result(result)
78
- expect(@log).to eq("\n\nFailures:\n\n 1) _description_\n\e[31m Failure/Error: _message_\n\e[0m\nFinished in 3.1337 seconds\n\e[31m666 examples, 1 failure\e[0m\n\nFailed examples:\n\n\e[31mteaspoon -s default --filter=\"_link_\"\e[0m\n")
79
- end
80
-
81
- end
82
-
83
- describe "with pending" do
84
-
85
- before do
86
- subject.pendings << pending_spec
87
- end
88
-
89
- it "logs the pending specs" do
90
- subject.result(result)
91
- expect(@log).to eq("\n\nPending:\n\e[33m _description_\e[0m\n\e[36m # Not yet implemented\n\e[0m\nFinished in 3.1337 seconds\n\e[33m666 examples, 0 failures, 1 pending\e[0m\n")
92
- end
93
-
94
- end
95
-
96
- end
97
-
98
- describe "#coverage" do
99
-
100
- it "logs the coverage" do
101
- subject.coverage("_text_\n\n_text_summary_")
102
- expect(@log).to eq("\n_text_\n\n_text_summary_\n")
103
- end
104
-
105
- end
106
-
107
- describe "#threshold_failure" do
108
-
109
- it "logs the threshold failures" do
110
- subject.threshold_failure("_was_not_met_\n_was_not_met_")
111
- expect(@log).to eq("\e[31m\n_was_not_met_\n_was_not_met_\n\e[0m\n")
112
- end
113
-
114
- end
115
-
116
- end
@@ -1,77 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe Teaspoon::Formatters::JsonFormatter do
4
-
5
- let(:hash) { {original_json: "_original_json_"} }
6
- let(:result) { double(hash) }
7
-
8
- describe "#runner" do
9
-
10
- let(:result) { double(hash.merge(total: 42)) }
11
-
12
- it "logs the original json" do
13
- expect(subject).to receive(:log_result).with(result)
14
- subject.runner(result)
15
- end
16
-
17
- end
18
-
19
- describe "#suite" do
20
-
21
- it "logs the original json" do
22
- expect(subject).to receive(:log_result).with(result)
23
- subject.suite(result)
24
- end
25
-
26
- end
27
-
28
- describe "#spec" do
29
-
30
- let(:result) { double(hash.merge(passing?: true)) }
31
-
32
- it "logs the original json" do
33
- expect(subject).to receive(:log_result).with(result)
34
- subject.spec(result)
35
- end
36
-
37
- end
38
-
39
- describe "#error" do
40
-
41
- it "logs the original json" do
42
- expect(subject).to receive(:log_result).with(result)
43
- subject.error(result)
44
- end
45
-
46
- end
47
-
48
- describe "#exception" do
49
-
50
- it "logs the original json" do
51
- expect(subject).to receive(:log_result).with(result)
52
- subject.exception(result)
53
- end
54
-
55
- end
56
-
57
- describe "#console" do
58
-
59
- it "logs the message as json" do
60
- expect(subject).to receive(:log_line).with(%Q{{"type":"console","log":"_message_"}})
61
- subject.console("_message_")
62
- end
63
-
64
- end
65
-
66
- describe "#result" do
67
-
68
- let(:result) { double(hash.merge(coverage: nil)) }
69
-
70
- it "logs the original json" do
71
- expect(subject).to receive(:log_str).with("_original_json_")
72
- subject.result(result)
73
- end
74
-
75
- end
76
-
77
- end
@@ -1,114 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe Teaspoon::Formatters::JunitFormatter do
4
-
5
- let(:passing_spec) { double(passing?: true, suite: "_suite_name_", label: "_passing_label_") }
6
- let(:pending_spec) { double(passing?: false, pending?: true, suite: "_suite_name_", label: "_pending_label_") }
7
- let(:failing_spec) { double(passing?: false, pending?: false, suite: "_suite&name_", label: "_failing&label_", message: "_failure_message_") }
8
-
9
- before do
10
- @log = ""
11
- allow(STDOUT).to receive(:print) { |s| @log << s }
12
- end
13
-
14
- describe "#runner" do
15
-
16
- let(:result) { double(start: "_start_", total: 42) }
17
-
18
- before do
19
- subject.instance_variable_set(:@suite_name, "not_default&")
20
- end
21
-
22
- it "starts the suite" do
23
- subject.runner(result)
24
- expect(@log).to eq(%Q{<?xml version="1.0" encoding="UTF-8"?>\n<testsuites name="Teaspoon">\n<testsuite name="not_default&amp;" tests="42" time="_start_">\n})
25
- end
26
-
27
- end
28
-
29
- describe "#suite" do
30
-
31
- let(:result) { double(label: "_suite>label_") }
32
-
33
- it "calls #log_end_suite" do
34
- expect(subject).to receive(:log_end_suite)
35
- subject.suite(result)
36
- end
37
-
38
- it "logs the start of the testsuite" do
39
- subject.suite(result)
40
- expect(@log).to eq(%Q{<testsuite name="_suite&gt;label_">\n})
41
- end
42
-
43
- end
44
-
45
- describe "#spec" do
46
-
47
- it "logs a passing testcase on passing results" do
48
- subject.spec(passing_spec)
49
- expect(@log).to eq(%Q{<testcase classname="_suite_name_" name="_passing_label_">\n</testcase>\n})
50
- end
51
-
52
- it "logs a skipped testcase on pending results" do
53
- subject.spec(pending_spec)
54
- expect(@log).to eq(%Q{<testcase classname="_suite_name_" name="_pending_label_">\n <skipped/>\n</testcase>\n})
55
- end
56
-
57
- it "logs a failing testcase with the message on failing results" do
58
- subject.spec(failing_spec)
59
- expect(@log).to include(%Q{<testcase classname="_suite&amp;name_" name="_failing&amp;label_">\n})
60
- expect(@log).to include(%Q{ <failure type="AssertionFailed">\n<![CDATA[\n_failure_message_\n]]>\n</failure>\n})
61
- expect(@log).to include(%Q{</testcase>\n})
62
- end
63
-
64
- it "includes any stdout" do
65
- subject.instance_variable_set(:@stdout, "_stdout_")
66
- subject.spec(passing_spec)
67
- expect(@log).to eq(%Q{<testcase classname="_suite_name_" name="_passing_label_">\n<system-out>\n<![CDATA[\n_stdout_\n]]>\n</system-out>\n</testcase>\n})
68
- end
69
-
70
- end
71
-
72
- describe "#result" do
73
-
74
- let(:result) { double(coverage: nil) }
75
-
76
- it "closes the last suite" do
77
- expect(subject).to receive(:log_end_suite)
78
- subject.result(result)
79
- end
80
-
81
- end
82
-
83
- describe "#coverage" do
84
-
85
- it "logs the coverage" do
86
- subject.coverage("_text_\n\n_text_summary_")
87
- expect(@log).to eq(%Q{<testsuite name="Coverage summary" tests="0">\n<properties>\n<![CDATA[\n_text_\n_text_summary_\n]]>\n</properties>\n</testsuite>\n})
88
- end
89
-
90
- end
91
-
92
- describe "#threshold_failure" do
93
-
94
- it "logs the threshold failures" do
95
- subject.threshold_failure("_was_not_met_\n_was_not_met_")
96
- expect(@log).to include(%Q{<testsuite name="Coverage thresholds" tests="1">\n})
97
- expect(@log).to include(%Q{<testcase classname="Coverage thresholds" name="were not met">\n})
98
- expect(@log).to include(%Q{ <failure type="AssertionFailed">\n<![CDATA[\n_was_not_met_\n_was_not_met_\n]]>\n</failure>\n})
99
- expect(@log).to include(%Q{</testcase>\n})
100
- expect(@log).to include(%Q{</testsuite>\n})
101
- end
102
-
103
- end
104
-
105
- describe "#complete" do
106
-
107
- it "logs the closing suite tags" do
108
- subject.complete(2)
109
- expect(@log).to include(%Q{</testsuite>\n</testsuites>})
110
- end
111
-
112
- end
113
-
114
- end