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::PrideFormatter do
4
-
5
- let(:passing_spec) { double(passing?: true) }
6
- let(:pending_spec) { double(passing?: false, pending?: true) }
7
- let(:failing_spec) { double(passing?: false, pending?: false) }
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 colorful . on passing results" do
17
- subject.spec(passing_spec)
18
- subject.spec(passing_spec)
19
- subject.spec(passing_spec)
20
- subject.spec(passing_spec)
21
- subject.spec(passing_spec)
22
- expect(@log).to eq("\e[38;5;154m.\e[0m\e[38;5;154m.\e[0m\e[38;5;148m.\e[0m\e[38;5;184m.\e[0m\e[38;5;184m.\e[0m")
23
- end
24
-
25
- it "logs a yellow * on pending results" do
26
- subject.spec(pending_spec)
27
- expect(@log).to eq("\e[33m*\e[0m")
28
- end
29
-
30
- it "logs a red F on failing results" do
31
- subject.spec(failing_spec)
32
- expect(@log).to eq("\e[31mF\e[0m")
33
- end
34
-
35
- end
36
-
37
- end
@@ -1,107 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe Teaspoon::Formatters::RspecHtmlFormatter do
4
-
5
- let(:suite) { double(label: "_suite&_", level: @level || 0)}
6
- let(:passing_spec) { double(passing?: true, failing?: false, elapsed: nil, status: "passed", label: "_passing&_") }
7
- let(:pending_spec) { double(passing?: false, pending?: true, failing?: false, elapsed: nil, status: "pending", label: "_pending&_", description: "_description&_") }
8
- let(:failing_spec) { double(passing?: false, pending?: false, failing?: true, elapsed: nil, status: "failed", label: "_failing&_", description: "_description&_", message: "_message&_", link: "_link&_", trace: "_trace&_") }
9
-
10
- before do
11
- @log = ""
12
- allow(STDOUT).to receive(:print) { |s| @log << s }
13
- end
14
-
15
- describe "#runner" do
16
-
17
- let(:result) { double(start: "_start&_", total: 42) }
18
-
19
- before do
20
- subject.instance_variable_set(:@suite_name, "not_default&")
21
- end
22
-
23
- it "starts the HTML" do
24
- subject.runner(result)
25
- expect(@log).to eq(Teaspoon::Formatters::RspecHtmlFormatter::Templates::HEADER)
26
- end
27
-
28
- end
29
-
30
- describe "#suite" do
31
-
32
- it "logs a suite header" do
33
- subject.suite(suite)
34
- expect(@log).to eq(Teaspoon::Formatters::RspecHtmlFormatter::Templates::SUITE_START.gsub("<%= h @o.label %>", "_suite&amp;_"))
35
- expect(subject.instance_variable_get(:@current_suite)).to eq(["_suite&_"])
36
- end
37
-
38
- it "finishes any ended suites" do
39
- subject.instance_variable_get(:@current_suite) << "Suite 1" << "Suite 2" << "Suite 3" << "Suite 4"
40
- @level = 2
41
- subject.suite(suite)
42
- expected_head = Teaspoon::Formatters::RspecHtmlFormatter::Templates::SUITE_END * 2
43
- expected_tail = Teaspoon::Formatters::RspecHtmlFormatter::Templates::SUITE_START.gsub("<%= h @o.label %>", "_suite&amp;_")
44
- expect(@log).to eq(expected_head + expected_tail)
45
- end
46
-
47
- end
48
-
49
- describe "#spec" do
50
-
51
- it "logs passing results" do
52
- subject.spec(passing_spec)
53
- expected_log = Teaspoon::Formatters::RspecHtmlFormatter::Templates::SPEC.gsub("<%= h @o.status %>", "passed")
54
- expected_log.gsub!("<%= h @o.label %>", "_passing&amp;_")
55
- expected_log.gsub!("<%= h \"\#{@o.elapsed}s\" if @o.elapsed %>", "")
56
- expected_log.gsub!(/\<% if @o.failing\? %\>.*?\<% end %\>/m, "")
57
- expect(@log).to eq(expected_log)
58
- end
59
-
60
- it "logs pending results" do
61
- subject.spec(pending_spec)
62
- expected_log = Teaspoon::Formatters::RspecHtmlFormatter::Templates::SPEC.gsub("<%= h @o.status %>", "pending")
63
- expected_log.gsub!("<%= h @o.label %>", "_pending&amp;_")
64
- expected_log.gsub!("<%= h \"\#{@o.elapsed}s\" if @o.elapsed %>", "")
65
- expected_log.gsub!(/\<% if @o.failing\? %\>.*?\<% end %\>/m, "")
66
- expect(@log).to eq(expected_log)
67
- end
68
-
69
- it "logs failing results" do
70
- subject.spec(failing_spec)
71
- expected_log = Teaspoon::Formatters::RspecHtmlFormatter::Templates::SPEC.gsub("<%= h @o.status %>", "failed")
72
- expected_log.gsub!("<%= h @o.label %>", "_failing&amp;_")
73
- expected_log.gsub!("<%= h \"\#{@o.elapsed}s\" if @o.elapsed %>", "")
74
- expected_log.gsub!("<%= h @o.trace %>", "_trace&amp;_")
75
- expected_log.gsub!("<% if @o.failing? %>", "")
76
- expected_log.gsub!("<% end %>", "")
77
- expect(@log).to eq(expected_log)
78
- end
79
-
80
- end
81
-
82
- describe "#result" do
83
-
84
- let(:result) { double(elapsed: 3.1337, coverage: nil) }
85
-
86
- before do
87
- subject.run_count = 666
88
- subject.failures << failing_spec
89
- subject.pendings << pending_spec
90
- end
91
-
92
- it "ends the HTML" do
93
- subject.result(result)
94
- expect(@log).to eq(Teaspoon::Formatters::RspecHtmlFormatter::Templates::FOOTER.gsub("<%= h @o.elapsed %>", "3.1337"))
95
- end
96
-
97
- it "finishes any remaining suites" do
98
- subject.instance_variable_get(:@current_suite) << "Suite 1" << "Suite 2"
99
- subject.result(result)
100
- expected_head = Teaspoon::Formatters::RspecHtmlFormatter::Templates::SUITE_END * 2
101
- expected_tail = Teaspoon::Formatters::RspecHtmlFormatter::Templates::FOOTER.gsub("<%= h @o.elapsed %>", "3.1337")
102
- expect(@log).to eq(expected_head + expected_tail)
103
- end
104
-
105
- end
106
-
107
- end
@@ -1,35 +0,0 @@
1
- # encoding: utf-8
2
-
3
- require "spec_helper"
4
-
5
- describe Teaspoon::Formatters::SnowdayFormatter do
6
-
7
- let(:passing_spec) { double(passing?: true) }
8
- let(:pending_spec) { double(passing?: false, pending?: true) }
9
- let(:failing_spec) { double(passing?: false, pending?: false) }
10
-
11
- before do
12
- @log = ""
13
- allow(STDOUT).to receive(:print) { |s| @log << s }
14
- end
15
-
16
- describe "#spec" do
17
-
18
- it "logs a snowy snowman on passing results" do
19
- subject.spec(passing_spec)
20
- expect(@log).to eq("\e[36m☃\e[0m")
21
- end
22
-
23
- it "logs a yellow sadface on pending results" do
24
- subject.spec(pending_spec)
25
- expect(@log).to eq("\e[33m☹\e[0m")
26
- end
27
-
28
- it "logs a red skull and crossbones on failing results" do
29
- subject.spec(failing_spec)
30
- expect(@log).to eq("\e[31m☠\e[0m")
31
- end
32
-
33
- end
34
-
35
- end
@@ -1,72 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe Teaspoon::Formatters::TapFormatter do
4
-
5
- let(:passing_spec) { double(passing?: true, description: "_passing_desc_") }
6
- let(:pending_spec) { double(passing?: false, pending?: true, description: "_pending_desc_") }
7
- let(:failing_spec) { double(passing?: false, pending?: false, description: "_failing_desc_", 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(total: 42) }
17
-
18
- it "logs the total count" do
19
- subject.runner(result)
20
- expect(@log).to eq("1..42\n")
21
- end
22
-
23
- end
24
-
25
- describe "#spec" do
26
-
27
- it "logs an ok on passing results" do
28
- subject.spec(passing_spec)
29
- expect(@log).to eq("ok 1 - _passing_desc_\n")
30
- end
31
-
32
- it "logs an ok but [pending] on pending results" do
33
- subject.spec(pending_spec)
34
- expect(@log).to eq("ok 1 - [pending] _pending_desc_\n")
35
- end
36
-
37
- it "logs a not ok on failing results" do
38
- subject.spec(failing_spec)
39
- expect(@log).to eq("not ok 1 - _failing_desc_\n FAIL _failure_message_\n")
40
- end
41
-
42
- end
43
-
44
- describe "#console" do
45
-
46
- it "logs the message" do
47
- subject.console("_message1_")
48
- subject.console("_message2_\n")
49
- expect(@log).to eq("# _message1_\n# _message2_\n")
50
- end
51
-
52
- end
53
-
54
- describe "#coverage" do
55
-
56
- it "logs the coverage" do
57
- subject.coverage("_text_\n\n_text_summary_")
58
- expect(@log).to eq("# _text_\n# \n# _text_summary_\n")
59
- end
60
-
61
- end
62
-
63
- describe "#threshold_failure" do
64
-
65
- it "logs the threshold failures" do
66
- subject.threshold_failure("_was_not_met_\n_was_not_met_")
67
- expect(@log).to eq("not ok 1 - Coverage threshold failed\n# _was_not_met_\n# _was_not_met_\n")
68
- end
69
-
70
- end
71
-
72
- end
@@ -1,80 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe Teaspoon::Formatters::TapYFormatter do
4
-
5
- let(:passing_spec) { double(passing?: true, label: "_passing_label_") }
6
- let(:pending_spec) { double(passing?: false, pending?: true, label: "_pending_label_", message: "_message_") }
7
- let(:failing_spec) { double(passing?: false, pending?: false, label: "_failing_label_", message: "_message_", link: "_link_") }
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
- it "logs the information" do
19
- subject.runner(result)
20
- expect(@log).to eq("---\ntype: suite\nstart: _start_\ncount: 42\nseed: 0\nrev: 4\n")
21
- end
22
-
23
- end
24
-
25
- describe "#suite" do
26
-
27
- let(:result) { double(label: "_label_", level: 1) }
28
-
29
- it "logs the information" do
30
- subject.suite(result)
31
- expect(@log).to eq("---\ntype: case\nlabel: _label_\nlevel: 1\n")
32
- end
33
-
34
- end
35
-
36
- describe "#spec" do
37
-
38
- it "calls passing_spec passing results" do
39
- subject.spec(passing_spec)
40
- expect(@log).to eq("---\ntype: test\nstatus: pass\nlabel: _passing_label_\nstdout: ''\n")
41
- end
42
-
43
- it "calls pending_spec on pending results" do
44
- subject.spec(pending_spec)
45
- expect(@log).to eq("---\ntype: test\nstatus: pending\nlabel: _pending_label_\nstdout: ''\nexception:\n message: _message_\n")
46
- end
47
-
48
- it "calls failing_spec on failing results" do
49
- subject.spec(failing_spec)
50
- expect(@log).to eq("---\ntype: test\nstatus: fail\nlabel: _failing_label_\nstdout: ''\nexception:\n message: _message_\n backtrace:\n - _link_#:0\n file: unknown\n line: unknown\n source: unknown\n snippet:\n '0': _link_\n class: Unknown\n")
51
- end
52
-
53
- it "provides the stdout" do
54
- subject.instance_variable_set(:@stdout, "_stdout_")
55
- subject.spec(passing_spec)
56
- expect(@log).to eq("---\ntype: test\nstatus: pass\nlabel: _passing_label_\nstdout: _stdout_\n")
57
- end
58
-
59
- end
60
-
61
- describe "#result" do
62
-
63
- let(:result) { double(elapsed: 3.1337, coverage: nil) }
64
-
65
- before do
66
- subject.run_count = 6
67
- subject.passes = [1, 2]
68
- subject.failures = [1]
69
- subject.errors = [1]
70
- subject.pendings = [1, 2]
71
- end
72
-
73
- it "logs the information" do
74
- subject.result(result)
75
- expect(@log).to eq("---\ntype: final\ntime: 3.1337\ncounts:\n total: 6\n pass: 2\n fail: 1\n error: 1\n omit: 0\n todo: 2\n")
76
- end
77
-
78
- end
79
-
80
- end
@@ -1,148 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe Teaspoon::Formatters::TeamcityFormatter do
4
-
5
- let(:suite) { double(label: "_suite_")}
6
- let(:passing_spec) { double(passing?: true, description: "_passing_[desc]\rip|'o\n_") }
7
- let(:pending_spec) { double(passing?: false, pending?: true, description: "_pending_[desc]_") }
8
- let(:failing_spec) { double(passing?: false, pending?: false, description: "_failing_[desc]_", message: "_failure_[mess]age_") }
9
- let(:result) { double }
10
-
11
- before do
12
- @log = ""
13
- allow(STDOUT).to receive(:print) { |s| @log << s }
14
- end
15
-
16
- describe "#runner" do
17
-
18
- let(:result) { double(total: 42, start: "_start_") }
19
-
20
- it "starts the suite" do
21
- expect(Time).to receive(:now).and_return(double(to_json: "_json_time_"))
22
- subject.runner(result)
23
- expect(@log).to include("##teamcity[enteredTheMatrix timestamp='_json_time_']\n")
24
- expect(@log).to include("##teamcity[testCount count='42' timestamp='_start_']\n")
25
- end
26
-
27
- end
28
-
29
- describe "#suite" do
30
-
31
- it "logs the suite" do
32
- subject.suite(suite)
33
- expect(@log).to include(%{##teamcity[testSuiteStarted name='_suite_']})
34
- end
35
-
36
- it "closes the last suite if there was one" do
37
- subject.instance_variable_set(:@last_suite, suite)
38
- subject.suite(suite)
39
- expect(@log).to include(%{##teamcity[testSuiteFinished name='_suite_']})
40
- end
41
-
42
- end
43
-
44
- describe "#spec" do
45
-
46
- it "logs a passing testcase on passing results" do
47
- subject.spec(passing_spec)
48
- expect(@log).to include(%{##teamcity[testStarted name='_passing_|[desc|]|rip|||'o|n_' captureStandardOutput='true']\n})
49
- expect(@log).to include(%{##teamcity[testFinished name='_passing_|[desc|]|rip|||'o|n_']\n})
50
- end
51
-
52
- it "logs a skipped testcase on pending results" do
53
- subject.spec(pending_spec)
54
- expect(@log).to include(%{##teamcity[testIgnored name='_pending_|[desc|]_' captureStandardOutput='true']\n})
55
- expect(@log).to include(%{##teamcity[testFinished name='_pending_|[desc|]_']\n})
56
- end
57
-
58
- it "logs a failing testcase with the message on failing results" do
59
- subject.spec(failing_spec)
60
- expect(@log).to include(%{##teamcity[testStarted name='_failing_|[desc|]_' captureStandardOutput='true']\n})
61
- expect(@log).to include(%{##teamcity[testFailed name='_failing_|[desc|]_' message='_failure_|[mess|]age_']\n})
62
- expect(@log).to include(%{##teamcity[testFinished name='_failing_|[desc|]_']\n})
63
- end
64
-
65
- it "captures stdout and puts it in the right place" do
66
- subject.instance_variable_set(:@stdout, "_stdout_\n")
67
- subject.spec(pending_spec)
68
- expect(@log).to include(%{##teamcity[testIgnored name='_pending_|[desc|]_' captureStandardOutput='true']\n})
69
- expect(@log).to include(%{_stdout_\n})
70
- expect(@log).to include(%{##teamcity[testFinished name='_pending_|[desc|]_']\n})
71
- end
72
-
73
- end
74
-
75
- describe "#error" do
76
-
77
- let(:result) { double(message: "_error_message_", trace: [{"file" => "myfile.js", "line" => "420"}, {"file" => "myfile.js", "line" => "666"}]) }
78
-
79
- it "logs the error" do
80
- subject.error(result)
81
- expect(@log).to include(%{##teamcity[message text='_error_message_' errorDetails='myfile.js:420|nmyfile.js:666' status='ERROR']\n})
82
- end
83
-
84
- end
85
-
86
- describe "#result" do
87
-
88
- it "closes any open suites" do
89
- subject.instance_variable_set(:@last_suite, double(label: "_last_suite_label_"))
90
- subject.result(result)
91
- expect(@log).to include(%{##teamcity[testSuiteFinished name='_last_suite_label_']})
92
- end
93
-
94
- it "assigns @result" do
95
- subject.result(result)
96
- expect(subject.instance_variable_get(:@result)).to eq(result)
97
- end
98
-
99
- end
100
-
101
- describe "#coverage" do
102
-
103
- it "logs the coverage" do
104
- subject.coverage("_text_\n\n_text_summary_")
105
- expect(@log).to include(%{##teamcity[testSuiteStarted name='Coverage summary']\n})
106
- expect(@log).to include(%{_text_\n\n_text_summary_\n})
107
- expect(@log).to include(%{##teamcity[testSuiteFinished name='Coverage summary']\n})
108
- end
109
-
110
- end
111
-
112
- describe "#threshold_failure" do
113
-
114
- it "logs the threshold failures" do
115
- subject.threshold_failure("_was_not_met_\n_was_not_met_")
116
- expect(@log).to include(%{##teamcity[testSuiteStarted name='Coverage thresholds']\n})
117
- expect(@log).to include(%{##teamcity[testStarted name='Coverage thresholds' captureStandardOutput='true']\n})
118
- expect(@log).to include(%{##teamcity[testFailed name='Coverage thresholds' message='were not met']\n})
119
- expect(@log).to include(%{_was_not_met_\n_was_not_met_\n})
120
- expect(@log).to include(%{##teamcity[testFinished name='Coverage thresholds']\n})
121
- expect(@log).to include(%{##teamcity[testSuiteFinished name='Coverage thresholds']\n})
122
- end
123
-
124
- end
125
-
126
- describe "#complete" do
127
-
128
- let(:result) { double(elapsed: 3.1337, coverage: nil) }
129
-
130
- before do
131
- subject.instance_variable_set(:@result, result)
132
-
133
- subject.run_count = 6
134
- subject.passes = [1, 2]
135
- subject.failures = [1]
136
- subject.errors = [1]
137
- subject.pendings = [1, 2]
138
- end
139
-
140
- it "ends the suite" do
141
- subject.complete(1)
142
- expect(@log).to include(%{Finished in 3.1337 seconds\n})
143
- expect(@log).to include(%{6 examples, 1 failure, 2 pending\n\n})
144
- end
145
-
146
- end
147
-
148
- end