teaspoon 0.7.9 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (163) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +382 -260
  3. data/app/assets/javascripts/teaspoon-angular.js +108 -26241
  4. data/app/assets/javascripts/teaspoon-jasmine.js +103 -2642
  5. data/app/assets/javascripts/teaspoon-mocha.js +109 -5416
  6. data/app/assets/javascripts/teaspoon-qunit.js +107 -2255
  7. data/app/assets/javascripts/teaspoon-teaspoon.js +0 -1
  8. data/app/assets/javascripts/teaspoon/angular.coffee +3 -1
  9. data/app/assets/javascripts/teaspoon/base/hook.coffee +21 -0
  10. data/app/assets/javascripts/teaspoon/base/reporters/html.coffee +26 -14
  11. data/app/assets/javascripts/teaspoon/base/reporters/html/progress_view.coffee +1 -1
  12. data/app/assets/javascripts/teaspoon/base/reporters/html/template.coffee +3 -3
  13. data/app/assets/javascripts/teaspoon/base/teaspoon.coffee +10 -1
  14. data/app/assets/javascripts/teaspoon/jasmine.coffee +3 -1
  15. data/app/assets/javascripts/teaspoon/mocha.coffee +3 -1
  16. data/app/assets/javascripts/teaspoon/mocha/reporters/html.coffee +1 -1
  17. data/app/assets/javascripts/teaspoon/qunit.coffee +3 -1
  18. data/app/assets/javascripts/teaspoon/qunit/reporters/html.coffee +1 -1
  19. data/app/assets/javascripts/teaspoon/teaspoon.coffee +0 -1
  20. data/app/assets/stylesheets/teaspoon.css +12 -8
  21. data/app/controllers/teaspoon/suite_controller.rb +32 -0
  22. data/app/views/teaspoon/suite/_body.html.erb +0 -0
  23. data/app/views/teaspoon/suite/_boot.html.erb +4 -0
  24. data/app/views/teaspoon/suite/_boot_require_js.html.erb +19 -0
  25. data/app/views/teaspoon/{spec/suites.html.erb → suite/index.html.erb} +6 -7
  26. data/app/views/teaspoon/suite/show.html.erb +19 -0
  27. data/bin/teaspoon +1 -1
  28. data/config/routes.rb +14 -4
  29. data/lib/generators/teaspoon/install/POST_INSTALL +2 -2
  30. data/lib/generators/teaspoon/install/install_generator.rb +22 -11
  31. data/lib/generators/teaspoon/install/templates/_body.html.erb +0 -0
  32. data/lib/generators/teaspoon/install/templates/_boot.html.erb +4 -0
  33. data/lib/generators/teaspoon/install/templates/jasmine/env.rb +11 -0
  34. data/lib/generators/teaspoon/install/templates/jasmine/env_comments.rb +182 -0
  35. data/lib/generators/teaspoon/install/templates/jasmine/spec_helper.coffee +8 -6
  36. data/lib/generators/teaspoon/install/templates/jasmine/spec_helper.js +8 -7
  37. data/lib/generators/teaspoon/install/templates/mocha/env.rb +11 -0
  38. data/lib/generators/teaspoon/install/templates/mocha/env_comments.rb +182 -0
  39. data/lib/generators/teaspoon/install/templates/mocha/spec_helper.coffee +13 -13
  40. data/lib/generators/teaspoon/install/templates/mocha/spec_helper.js +13 -13
  41. data/lib/generators/teaspoon/install/templates/qunit/env.rb +11 -0
  42. data/lib/generators/teaspoon/install/templates/qunit/env_comments.rb +182 -0
  43. data/lib/generators/teaspoon/install/templates/qunit/test_helper.coffee +6 -5
  44. data/lib/generators/teaspoon/install/templates/qunit/test_helper.js +6 -5
  45. data/lib/tasks/teaspoon.rake +9 -2
  46. data/lib/teaspoon.rb +4 -6
  47. data/lib/teaspoon/command_line.rb +116 -134
  48. data/lib/teaspoon/configuration.rb +144 -66
  49. data/lib/teaspoon/console.rb +70 -37
  50. data/lib/teaspoon/coverage.rb +42 -15
  51. data/lib/teaspoon/deprecated.rb +65 -0
  52. data/lib/teaspoon/drivers/base.rb +10 -0
  53. data/lib/teaspoon/drivers/phantomjs/runner.js +9 -11
  54. data/lib/teaspoon/drivers/phantomjs_driver.rb +21 -21
  55. data/lib/teaspoon/drivers/selenium_driver.rb +32 -13
  56. data/lib/teaspoon/engine.rb +32 -12
  57. data/lib/teaspoon/environment.rb +16 -12
  58. data/lib/teaspoon/exceptions.rb +41 -5
  59. data/lib/teaspoon/exporter.rb +52 -0
  60. data/lib/teaspoon/formatters/base.rb +171 -0
  61. data/lib/teaspoon/formatters/clean_formatter.rb +2 -4
  62. data/lib/teaspoon/formatters/documentation_formatter.rb +60 -0
  63. data/lib/teaspoon/formatters/dot_formatter.rb +12 -90
  64. data/lib/teaspoon/formatters/json_formatter.rb +36 -0
  65. data/lib/teaspoon/formatters/junit_formatter.rb +51 -32
  66. data/lib/teaspoon/formatters/modules/report_module.rb +76 -0
  67. data/lib/teaspoon/formatters/pride_formatter.rb +23 -27
  68. data/lib/teaspoon/formatters/snowday_formatter.rb +7 -11
  69. data/lib/teaspoon/formatters/swayze_or_oprah_formatter.rb +88 -64
  70. data/lib/teaspoon/formatters/tap_formatter.rb +18 -27
  71. data/lib/teaspoon/formatters/tap_y_formatter.rb +35 -45
  72. data/lib/teaspoon/formatters/teamcity_formatter.rb +69 -31
  73. data/lib/teaspoon/instrumentation.rb +33 -33
  74. data/lib/teaspoon/result.rb +2 -1
  75. data/lib/teaspoon/runner.rb +40 -28
  76. data/lib/teaspoon/server.rb +23 -25
  77. data/lib/teaspoon/suite.rb +52 -72
  78. data/lib/teaspoon/utility.rb +3 -14
  79. data/lib/teaspoon/version.rb +1 -1
  80. data/spec/dummy/app/assets/javascripts/integration/integration_spec.coffee +3 -0
  81. data/spec/dummy/app/assets/javascripts/integration/spec_helper.coffee +2 -0
  82. data/spec/dummy/config/application.rb +3 -0
  83. data/spec/features/console_reporter_spec.rb +48 -18
  84. data/spec/features/hooks_spec.rb +23 -41
  85. data/spec/features/html_reporter_spec.rb +38 -21
  86. data/spec/features/install_generator_spec.rb +34 -20
  87. data/spec/features/instrumentation_spec.rb +3 -2
  88. data/spec/fixtures/coverage.json +243 -0
  89. data/spec/javascripts/fixtures/_body.html.erb +1 -0
  90. data/spec/javascripts/jasmine_helper.coffee +1 -1
  91. data/spec/javascripts/teaspoon/base/fixture_spec.coffee +4 -4
  92. data/spec/javascripts/teaspoon/base/reporters/html_spec.coffee +9 -10
  93. data/spec/javascripts/teaspoon/mocha/reporters/html_mspec.coffee +0 -6
  94. data/spec/javascripts/teaspoon/phantomjs/runner_spec.coffee +5 -6
  95. data/spec/javascripts/turbolinks_helper.coffee +1 -1
  96. data/spec/spec_helper.rb +3 -4
  97. data/spec/teaspoon/command_line_spec.rb +139 -23
  98. data/spec/teaspoon/configuration_spec.rb +164 -46
  99. data/spec/teaspoon/console_spec.rb +142 -47
  100. data/spec/teaspoon/coverage_spec.rb +98 -28
  101. data/spec/teaspoon/drivers/base_spec.rb +5 -0
  102. data/spec/teaspoon/drivers/phantomjs_driver_spec.rb +32 -14
  103. data/spec/teaspoon/drivers/selenium_driver_spec.rb +32 -24
  104. data/spec/teaspoon/engine_spec.rb +8 -5
  105. data/spec/teaspoon/environment_spec.rb +56 -33
  106. data/spec/teaspoon/exceptions_spec.rb +57 -0
  107. data/spec/teaspoon/exporter_spec.rb +96 -0
  108. data/spec/teaspoon/formatters/base_spec.rb +259 -0
  109. data/spec/teaspoon/formatters/clean_formatter_spec.rb +37 -0
  110. data/spec/teaspoon/formatters/documentation_formatter_spec.rb +127 -0
  111. data/spec/teaspoon/formatters/dot_formatter_spec.rb +52 -56
  112. data/spec/teaspoon/formatters/json_formatter_spec.rb +77 -0
  113. data/spec/teaspoon/formatters/junit_formatter_spec.rb +72 -35
  114. data/spec/teaspoon/formatters/pride_formatter_spec.rb +37 -0
  115. data/spec/teaspoon/formatters/snowday_formatter_spec.rb +35 -0
  116. data/spec/teaspoon/formatters/tap_formatter_spec.rb +29 -81
  117. data/spec/teaspoon/formatters/tap_y_formatter_spec.rb +31 -141
  118. data/spec/teaspoon/formatters/teamcity_formatter_spec.rb +99 -42
  119. data/spec/teaspoon/instrumentation_spec.rb +44 -44
  120. data/spec/teaspoon/result_spec.rb +37 -0
  121. data/spec/teaspoon/runner_spec.rb +70 -59
  122. data/spec/teaspoon/server_spec.rb +34 -52
  123. data/spec/teaspoon/suite_spec.rb +42 -188
  124. data/spec/teaspoon_env.rb +39 -28
  125. data/vendor/assets/javascripts/{angular-scenario-1.0.5.js → angular/1.0.5.js} +0 -0
  126. data/vendor/assets/javascripts/{angular-scenario-1.0.5.MIT-LICENSE → angular/MIT-LICENSE} +0 -0
  127. data/vendor/assets/javascripts/{jasmine-1.3.1.js → jasmine/1.3.1.js} +0 -0
  128. data/vendor/assets/javascripts/jasmine/2.0.0.js +2412 -0
  129. data/vendor/assets/javascripts/{jasmine-1.3.1.MIT.LICENSE → jasmine/MIT.LICENSE} +0 -0
  130. data/vendor/assets/javascripts/{mocha-1.10.0.js → mocha/1.10.0.js} +1 -0
  131. data/vendor/assets/javascripts/mocha/1.17.1.js +5813 -0
  132. data/vendor/assets/javascripts/{mocha-1.10.1.MIT.LICENSE → mocha/MIT.LICENSE} +0 -0
  133. data/vendor/assets/javascripts/{qunit-1.12.0.js → qunit/1.12.0.js} +1 -1
  134. data/vendor/assets/javascripts/qunit/1.14.0.js +2288 -0
  135. data/vendor/assets/javascripts/{qunit-1.12.0.MIT.LICENSE → qunit/MIT.LICENSE} +0 -0
  136. data/vendor/assets/javascripts/support/chai.js +827 -385
  137. data/vendor/assets/javascripts/support/jasmine-jquery-1.7.0.js +720 -0
  138. data/vendor/assets/javascripts/support/jasmine-jquery-2.0.0.js +812 -0
  139. data/vendor/assets/javascripts/support/sinon-chai.js +17 -0
  140. data/vendor/assets/javascripts/support/sinon.js +1138 -643
  141. metadata +57 -36
  142. data/app/controllers/teaspoon/spec_controller.rb +0 -38
  143. data/app/helpers/teaspoon/spec_helper.rb +0 -36
  144. data/app/views/teaspoon/spec/_require_js.html.erb +0 -21
  145. data/app/views/teaspoon/spec/_standard.html.erb +0 -4
  146. data/app/views/teaspoon/spec/runner.html.erb +0 -19
  147. data/lib/generators/teaspoon/install/templates/env.rb +0 -38
  148. data/lib/generators/teaspoon/install/templates/jasmine/initializer.rb +0 -64
  149. data/lib/generators/teaspoon/install/templates/mocha/initializer.rb +0 -64
  150. data/lib/generators/teaspoon/install/templates/qunit/initializer.rb +0 -64
  151. data/lib/teaspoon/check_coverage.rb +0 -33
  152. data/lib/teaspoon/drivers/base_driver.rb +0 -10
  153. data/lib/teaspoon/exception_handling.rb +0 -18
  154. data/lib/teaspoon/formatters/base_formatter.rb +0 -63
  155. data/spec/dummy/config/initializers/teaspoon.rb +0 -41
  156. data/spec/teaspoon/check_coverage_spec.rb +0 -50
  157. data/spec/teaspoon/formatters/base_formatter_spec.rb +0 -45
  158. data/vendor/assets/javascripts/support/chai.MIT.LICENSE +0 -22
  159. data/vendor/assets/javascripts/support/expect.MIT.LICENSE +0 -22
  160. data/vendor/assets/javascripts/support/jasmine-jquery.MIT.LICENSE +0 -20
  161. data/vendor/assets/javascripts/support/jasmine-jquery.js +0 -659
  162. data/vendor/assets/javascripts/support/sinon-chai.MIT-ISH.LICENSE +0 -13
  163. data/vendor/assets/javascripts/support/sinon.BSD.LICENSE +0 -27
@@ -0,0 +1,76 @@
1
+ module Teaspoon
2
+ module Formatters
3
+ module ReportModule
4
+
5
+ RED = 31
6
+ GREEN = 32
7
+ YELLOW = 33
8
+ CYAN = 36
9
+
10
+ def log_error(result)
11
+ log_line(result.message, RED)
12
+ for trace in result.trace || []
13
+ log_line(" # #{filename(trace["file"])}:#{trace["line"]}#{trace["function"].present? ? " -- #{trace["function"]}" : ""}", CYAN)
14
+ end
15
+ log_line
16
+ end
17
+
18
+ def log_result(result)
19
+ log_information
20
+ log_stats(result)
21
+ log_failed_examples
22
+ end
23
+
24
+ def log_coverage(message)
25
+ log_line("\n#{message}")
26
+ end
27
+
28
+ def log_threshold_failure(message)
29
+ log_line("\n#{message}\n", RED)
30
+ end
31
+
32
+ private
33
+
34
+ def log_information
35
+ log_pending if pendings.size > 0
36
+ log_failures if failures.size > 0
37
+ end
38
+
39
+ def log_pending
40
+ log_line("Pending:")
41
+ pendings.each do |result|
42
+ log_line(" #{result.description}", YELLOW)
43
+ log_line(" # Not yet implemented\n", CYAN)
44
+ end
45
+ end
46
+
47
+ def log_failures
48
+ log_line("Failures:\n")
49
+ failures.each_with_index do |failure, index|
50
+ log_line(" #{index + 1}) #{failure.description}")
51
+ log_line(" Failure/Error: #{failure.message}\n", RED)
52
+ end
53
+ end
54
+
55
+ def log_stats(result)
56
+ log_line("Finished in #{result.elapsed} seconds")
57
+ stats = "#{pluralize("example", run_count)}, #{pluralize("failure", failures.size)}"
58
+ stats << ", #{pendings.size} pending" if pendings.size > 0
59
+ log_line(stats, stats_color)
60
+ end
61
+
62
+ def log_failed_examples
63
+ return if failures.size == 0
64
+ log_line
65
+ log_line("Failed examples:\n")
66
+ failures.each do |failure|
67
+ log_line("teaspoon -s #{@suite_name} --filter=\"#{failure.link}\"", RED)
68
+ end
69
+ end
70
+
71
+ def stats_color
72
+ failures.size > 0 ? RED : pendings.size > 0 ? YELLOW : GREEN
73
+ end
74
+ end
75
+ end
76
+ end
@@ -1,48 +1,44 @@
1
- require 'teaspoon/formatters/dot_formatter'
2
-
3
1
  module Teaspoon
4
2
  module Formatters
5
3
  class PrideFormatter < DotFormatter
4
+
6
5
  PI_3 = Math::PI / 3
7
6
 
8
7
  def initialize(*args)
9
- @colors = (0...(6 * 7)).map { |n|
10
- n *= 1.0 / 6
11
- r = (3 * Math.sin(n ) + 3).to_i
12
- g = (3 * Math.sin(n + 2 * PI_3) + 3).to_i
13
- b = (3 * Math.sin(n + 4 * PI_3) + 3).to_i
14
- 36 * r + 6 * g + b + 16
15
- }
16
- @size = @colors.size
17
- @index = 0
18
-
8
+ @color_index = 0
19
9
  super
20
10
  end
21
11
 
22
- def spec(result)
23
- super(result, true)
24
- if result.passing?
25
- log_pride ".", next_color
26
- elsif result.pending?
27
- log "*", YELLOW
28
- else
29
- log "F", RED
30
- end
12
+ protected
13
+
14
+ def log_spec(result)
15
+ return log_pride if result.passing?
16
+ super
31
17
  end
32
18
 
33
19
  private
34
20
 
35
- def next_color
36
- c = @colors[@index % @size]
37
- @index += 1
38
- c
21
+ def log_pride
22
+ return log_str(".") unless Teaspoon.configuration.color
23
+ log_str("\e[38;5;#{next_color}m.\e[0m")
39
24
  end
40
25
 
26
+ def colors
27
+ @colors ||= (0...42).map do |i|
28
+ i *= 1.0 / 6
29
+ 36 * calc_color(i) + 6 * calc_color(i + 2 * PI_3) + calc_color(i + 4 * PI_3) + 16
30
+ end
31
+ end
41
32
 
42
- def log_pride(str, color_code)
43
- STDOUT.print("\e[38;5;#{color_code}m#{str}\e[0m")
33
+ def calc_color(val)
34
+ (3 * Math.sin(val) + 3).to_i
44
35
  end
45
36
 
37
+ def next_color
38
+ c = colors[@color_index % colors.size]
39
+ @color_index += 1
40
+ c
41
+ end
46
42
  end
47
43
  end
48
44
  end
@@ -1,20 +1,16 @@
1
- require 'teaspoon/formatters/dot_formatter'
1
+ # encoding: utf-8
2
2
 
3
3
  module Teaspoon
4
4
  module Formatters
5
5
  class SnowdayFormatter < DotFormatter
6
6
 
7
- def spec(result)
8
- super(result, true)
9
- if result.passing?
10
- log "☃", GREEN
11
- elsif result.pending?
12
- log "☹", YELLOW
13
- else
14
- log "☠", RED
15
- end
16
- end
7
+ protected
17
8
 
9
+ def log_spec(result)
10
+ return log_str("☃", CYAN) if result.passing?
11
+ return log_str("☹", YELLOW) if result.pending?
12
+ log_str("☠", RED)
13
+ end
18
14
  end
19
15
  end
20
16
  end
@@ -1,76 +1,100 @@
1
1
  module Teaspoon
2
2
  module Formatters
3
- class SwayzeOrOprahFormatter < BaseFormatter
3
+ class SwayzeOrOprahFormatter < Base
4
4
 
5
- def result(results)
6
- if failures.size == 0
7
- quote = QUOTES[Random.rand(QUOTES.size)]
8
- STDOUT.print("\n#{quote.inspect} -- Oprah Winfrey or Patrick Swayze?\n")
5
+ protected
6
+
7
+ def log_result(result)
8
+ return log_str("\nNo quote for you.") if failures.size > 0
9
+ names, quote = random_quote
10
+ log_line("\n#{quote.inspect} -- Oprah Winfrey or Patrick Swayze?")
11
+ log_str("Will your run be successful? [swayze or oprah]: ")
12
+ if names.include?(gets.chomp)
13
+ log_line("\nYou got it right!\n")
9
14
  else
10
- STDOUT.print("\nNo quote for you.\n")
15
+ log_line("\nWrong, too bad!\n")
16
+ raise the roof - YO && "Let's get busy"
11
17
  end
12
- super
13
18
  end
14
19
 
15
- QUOTES = [
16
- # patrick swayze
17
- "When those you love die, the best you can do is honor their spirit for as long as you live. You make a commitment that you're going to take whatever lesson that person or animal was trying to teach you, and you make it true in your own life... it's a positive way to keep their spirit alive in the world, by keeping it alive in yourself.",
18
- "The way to screw up somebody's life is to give them what they want.",
19
- "There's just something about dance ... It's like a primal thing in all of us.",
20
- "Pain don't hurt.",
21
- "What winning is to me is not giving up, is no matter what's thrown at me, I can take it. And I can keep going.",
22
- "Good-looking people turn me off. Myself included.",
23
- "One thing I'm not going to do is chase staying alive. You spend so much time chasing staying alive, you won't live.",
24
- "The way to screw up somebody's life is to give them what they want.",
25
- "There's just something about dance. It's like a primal thing in all of us.",
26
- "As always, I appreciate all the love and support people have sent and continue to send my way.",
27
- "Everything is designed to help you sell out.",
28
- "How do you nurture a positive attitude when all the statistics say you're a dead man? You go to work.",
29
- "I am very, very clear on how difficult it is for a young kid out there to go into the arts without taking a lot of heat from his peers.",
30
- "I don't know how many hills and valleys I've had, how many times I've had to refocus my world and my life and my career.",
31
- "I don't know what's on the other side.",
32
- "I don't want to be a poster child for cancer.",
33
- "I don't want to be Mr. Romantic Leading Man. I don't want to be the Dance Dude. I don't want to be the Action Guy. If I had to do any one of those all my life, it'd drive me crazy.",
34
- "I dropped about 20 pounds in the blink of an eye. And then when you see it in the mirror, when all of a sudden you pull your eyes down, and the bottom of your eyes go yellow and jaundice sets in - then you know something's wrong.",
35
- "I got completely fed up with that Hollywood blockbuster mentality. I couldn't take it seriously any longer.",
36
- "I had a lot of anger because I wasn't happy with the way I had been raised.",
37
- "I just love to work hard.",
38
- "I keep dreaming of a future, a future with a long and healthy life, not lived in the shadow of cancer but in the light.",
39
- "I keep my heart and my soul and my spirit open to miracles.",
40
- "I like to believe that I've got a lot of guardian warriors sittin' on my shoulder including my dad.",
41
- "I took after my father.",
42
- "I wanna live.",
43
- "I will go so far as to say probably smoking had something to do with my pancreatic cancer.",
44
- "I'm trying to shut up and let my angels speak to me and tell me what I'm supposed to do.",
45
- "I've had so many injuries.",
20
+ private
21
+
22
+ DATA = [
23
+ {
24
+ author: ["patrick swayze", "patrick", "swayze", "ps", "p"],
25
+ quotes: [
26
+ "When those you love die, the best you can do is honor their spirit for as long as you live. You make a commitment that you're going to take whatever lesson that person or animal was trying to teach you, and you make it true in your own life... it's a positive way to keep their spirit alive in the world, by keeping it alive in yourself.",
27
+ "The way to screw up somebody's life is to give them what they want.",
28
+ "There's just something about dance ... It's like a primal thing in all of us.",
29
+ "Pain don't hurt.",
30
+ "What winning is to me is not giving up, is no matter what's thrown at me, I can take it. And I can keep going.",
31
+ "Good-looking people turn me off. Myself included.",
32
+ "One thing I'm not going to do is chase staying alive. You spend so much time chasing staying alive, you won't live.",
33
+ "The way to screw up somebody's life is to give them what they want.",
34
+ "There's just something about dance. It's like a primal thing in all of us.",
35
+ "As always, I appreciate all the love and support people have sent and continue to send my way.",
36
+ "Everything is designed to help you sell out.",
37
+ "How do you nurture a positive attitude when all the statistics say you're a dead man? You go to work.",
38
+ "I am very, very clear on how difficult it is for a young kid out there to go into the arts without taking a lot of heat from his peers.",
39
+ "I don't know how many hills and valleys I've had, how many times I've had to refocus my world and my life and my career.",
40
+ "I don't know what's on the other side.",
41
+ "I don't want to be a poster child for cancer.",
42
+ "I don't want to be Mr. Romantic Leading Man. I don't want to be the Dance Dude. I don't want to be the Action Guy. If I had to do any one of those all my life, it'd drive me crazy.",
43
+ "I dropped about 20 pounds in the blink of an eye. And then when you see it in the mirror, when all of a sudden you pull your eyes down, and the bottom of your eyes go yellow and jaundice sets in - then you know something's wrong.",
44
+ "I got completely fed up with that Hollywood blockbuster mentality. I couldn't take it seriously any longer.",
45
+ "I had a lot of anger because I wasn't happy with the way I had been raised.",
46
+ "I just love to work hard.",
47
+ "I keep dreaming of a future, a future with a long and healthy life, not lived in the shadow of cancer but in the light.",
48
+ "I keep my heart and my soul and my spirit open to miracles.",
49
+ "I like to believe that I've got a lot of guardian warriors sittin' on my shoulder including my dad.",
50
+ "I took after my father.",
51
+ "I wanna live.",
52
+ "I will go so far as to say probably smoking had something to do with my pancreatic cancer.",
53
+ "I'm trying to shut up and let my angels speak to me and tell me what I'm supposed to do.",
54
+ "I've had so many injuries.",
55
+ ]
56
+ },
46
57
 
47
- # oprah winfrey
48
- "Lots of people want to ride with you in the limo, but what you want is someone who will take the bus with you when the limo breaks down.",
49
- "Be thankful for what you have; you'll end up having more. If you concentrate on what you don't have, you will never, ever have enough.",
50
- "The more you praise and celebrate your life, the more there is in life to celebrate.",
51
- "Surround yourself with only people who are going to lift you higher.",
52
- "Breathe. Let go. And remind yourself that this very moment is the only one you know you have for sure.",
53
- "As you become more clear about who you really are, you'll be better able to decide what is best for you - the first time around.",
54
- "It isn't until you come to a spiritual understanding of who you are - not necessarily a religious feeling, but deep down, the spirit within - that you can begin to take control.",
55
- "I am a woman in process. I'm just trying like everybody else. I try to take every conflict, every experience, and learn from it. Life is never dull.",
56
- "Turn your wounds into wisdom.",
57
- "Doing the best at this moment puts you in the best place for the next moment.",
58
- "Where there is no struggle, there is no strength.",
59
- "Do the one thing you think you cannot do. Fail at it. Try again. Do better the second time. The only people who never tumble are those who never mount the high wire. This is your moment. Own it.",
60
- "Passion is energy. Feel the power that comes from focusing on what excites you.",
61
- "I don't think of myself as a poor deprived ghetto girl who made good. I think of myself as somebody who from an early age knew I was responsible for myself, and I had to make good.",
62
- "Think like a queen. A queen is not afraid to fail. Failure is another steppingstone to greatness.",
63
- "I believe that every single event in life happens in an opportunity to choose love over fear.",
64
- "The greatest discovery of all time is that a person can change his future by merely changing his attitude.",
65
- "I don't believe in failure. It is not failure if you enjoyed the process.",
66
- "I don't think you ever stop giving. I really don't. I think it's an on-going process. And it's not just about being able to write a check. It's being able to touch somebody's life.",
67
- "The struggle of my life created empathy - I could relate to pain, being abandoned, having people not love me.",
68
- "What material success does is provide you with the ability to concentrate on other things that really matter. And that is being able to make a difference, not only in your own life, but in other people's lives.",
69
- "Books were my pass to personal freedom. I learned to read at age three, and soon discovered there was a whole world to conquer that went beyond our farm in Mississippi.",
70
- "Biology is the least of what makes someone a mother.",
71
- "Real integrity is doing the right thing, knowing that nobody's going to know whether you did it or not.",
72
- "I have a lot of things to prove to myself. One is that I can live my life fearlessly."
58
+ {
59
+ author: ["oprah winfrey", "oprah", "winfrey", "ow", "o"],
60
+ quotes: [
61
+ "Lots of people want to ride with you in the limo, but what you want is someone who will take the bus with you when the limo breaks down.",
62
+ "Be thankful for what you have; you'll end up having more. If you concentrate on what you don't have, you will never, ever have enough.",
63
+ "The more you praise and celebrate your life, the more there is in life to celebrate.",
64
+ "Surround yourself with only people who are going to lift you higher.",
65
+ "Breathe. Let go. And remind yourself that this very moment is the only one you know you have for sure.",
66
+ "As you become more clear about who you really are, you'll be better able to decide what is best for you - the first time around.",
67
+ "It isn't until you come to a spiritual understanding of who you are - not necessarily a religious feeling, but deep down, the spirit within - that you can begin to take control.",
68
+ "I am a woman in process. I'm just trying like everybody else. I try to take every conflict, every experience, and learn from it. Life is never dull.",
69
+ "Turn your wounds into wisdom.",
70
+ "Doing the best at this moment puts you in the best place for the next moment.",
71
+ "Where there is no struggle, there is no strength.",
72
+ "Do the one thing you think you cannot do. Fail at it. Try again. Do better the second time. The only people who never tumble are those who never mount the high wire. This is your moment. Own it.",
73
+ "Passion is energy. Feel the power that comes from focusing on what excites you.",
74
+ "I don't think of myself as a poor deprived ghetto girl who made good. I think of myself as somebody who from an early age knew I was responsible for myself, and I had to make good.",
75
+ "Think like a queen. A queen is not afraid to fail. Failure is another steppingstone to greatness.",
76
+ "I believe that every single event in life happens in an opportunity to choose love over fear.",
77
+ "The greatest discovery of all time is that a person can change his future by merely changing his attitude.",
78
+ "I don't believe in failure. It is not failure if you enjoyed the process.",
79
+ "I don't think you ever stop giving. I really don't. I think it's an on-going process. And it's not just about being able to write a check. It's being able to touch somebody's life.",
80
+ "The struggle of my life created empathy - I could relate to pain, being abandoned, having people not love me.",
81
+ "What material success does is provide you with the ability to concentrate on other things that really matter. And that is being able to make a difference, not only in your own life, but in other people's lives.",
82
+ "Books were my pass to personal freedom. I learned to read at age three, and soon discovered there was a whole world to conquer that went beyond our farm in Mississippi.",
83
+ "Biology is the least of what makes someone a mother.",
84
+ "Real integrity is doing the right thing, knowing that nobody's going to know whether you did it or not.",
85
+ "I have a lot of things to prove to myself. One is that I can live my life fearlessly."
86
+ ]
87
+ }
73
88
  ]
89
+
90
+ def random_quote
91
+ set = DATA[rand(DATA.size)]
92
+ [set[:author], set[:quotes][rand(set[:quotes].size)]]
93
+ end
94
+
95
+ def the(*args); Exception.new("poorly answered question"); end
96
+ def roof; 0; end
97
+ YO = 0
74
98
  end
75
99
  end
76
100
  end
@@ -1,47 +1,38 @@
1
- require 'teaspoon/formatters/base_formatter'
2
-
3
1
  module Teaspoon
4
2
  module Formatters
5
- class TapFormatter < BaseFormatter
3
+ class TapFormatter < Base
6
4
 
7
- def runner(result)
8
- log "1..#{result.total}"
9
- end
5
+ protected
10
6
 
11
- def spec(result)
12
- super
13
- @result = result
14
- return passing_spec if result.passing?
15
- return pending_spec if result.pending?
16
- failing_spec
7
+ def log_runner(result)
8
+ log_line("1..#{@total_count}")
17
9
  end
18
10
 
19
- def error(error)
20
- @errors << error
11
+ def log_passing_spec(result)
12
+ log_line("ok #{@run_count} - #{result.description}")
21
13
  end
22
14
 
23
- def suppress_logs?
24
- true
15
+ def log_pending_spec(result)
16
+ log_line("ok #{@run_count} - [pending] #{result.description}")
25
17
  end
26
18
 
27
- private
28
-
29
- def passing_spec
30
- log "ok #{@total} - #{@result.description}"
19
+ def log_failing_spec(result)
20
+ log_line("not ok #{@run_count} - #{result.description}")
21
+ log_line(" FAIL #{result.message}")
31
22
  end
32
23
 
33
- def pending_spec
34
- log "ok #{@total} - [pending] #{@result.description}"
24
+ def log_console(message)
25
+ log_line("# #{message.gsub(/\n$/, "")}")
35
26
  end
36
27
 
37
- def failing_spec
38
- log "not ok #{@total} - #{@result.description}\n # FAIL #{@result.message}"
28
+ def log_coverage(message)
29
+ log_line("# #{message.gsub(/\n/, "\n# ")}")
39
30
  end
40
31
 
41
- def log(str)
42
- STDOUT.print("#{str}\n")
32
+ def log_threshold_failure(message)
33
+ log_line("not ok #{@run_count + 1} - Coverage threshold failed")
34
+ log_line("# #{message.gsub(/\n/, "\n# ")}")
43
35
  end
44
-
45
36
  end
46
37
  end
47
38
  end
@@ -1,11 +1,12 @@
1
- require 'teaspoon/formatters/base_formatter'
2
- require 'yaml'
1
+ require "yaml"
3
2
 
4
3
  module Teaspoon
5
4
  module Formatters
6
- class TapYFormatter < BaseFormatter
5
+ class TapYFormatter < Base
7
6
 
8
- def runner(result)
7
+ protected
8
+
9
+ def log_runner(result)
9
10
  log "type" => "suite",
10
11
  "start" => result.start,
11
12
  "count" => result.total,
@@ -13,74 +14,63 @@ module Teaspoon
13
14
  "rev" => 4
14
15
  end
15
16
 
16
- def suite(result)
17
+ def log_suite(result)
17
18
  log "type" => "case",
18
19
  "label" => result.label,
19
20
  "level" => result.level
20
21
  end
21
22
 
22
- def spec(result)
23
- super
24
- @result = result
25
- return passing_spec if result.passing?
26
- return pending_spec if result.pending?
27
- failing_spec
28
- end
29
-
30
- def result(result)
31
- log "type" => "final",
32
- "time" => result.elapsed,
33
- "counts" => {
34
- "total" => @total,
35
- "pass" => @passes.size,
36
- "fail" => @failures.size,
37
- "error" => @errors.size,
38
- "omit" => 0,
39
- "todo" => @pendings.size
40
- }
41
- super
42
- end
43
-
44
- def error(error)
45
- @errors << error
46
- end
47
-
48
- private
49
-
50
- def passing_spec
23
+ def log_passing_spec(result)
51
24
  log "type" => "test",
52
25
  "status" => "pass",
53
- "label" => @result.label
26
+ "label" => result.label,
27
+ "stdout" => @stdout
54
28
  end
55
29
 
56
- def pending_spec
30
+ def log_pending_spec(result)
57
31
  log "type" => "test",
58
32
  "status" => "pending",
59
- "label" => @result.label,
33
+ "label" => result.label,
34
+ "stdout" => @stdout,
60
35
  "exception" => {
61
- "message" => @result.message
36
+ "message" => result.message
62
37
  }
63
38
  end
64
39
 
65
- def failing_spec
40
+ def log_failing_spec(result)
66
41
  log "type" => "test",
67
42
  "status" => "fail",
68
- "label" => @result.label,
43
+ "label" => result.label,
44
+ "stdout" => @stdout,
69
45
  "exception" => {
70
- "message" => @result.message,
71
- "backtrace" => ["#{@result.link}#:0"],
46
+ "message" => result.message,
47
+ "backtrace" => ["#{result.link}#:0"],
72
48
  "file" => "unknown",
73
49
  "line" => "unknown",
74
50
  "source" => "unknown",
75
- "snippet" => {"0" => @result.link},
51
+ "snippet" => {"0" => result.link},
76
52
  "class" => "Unknown"
77
53
  }
78
54
  end
79
55
 
80
- def log(hash)
81
- STDOUT.print(hash.to_yaml)
56
+ def log_result(result)
57
+ log "type" => "final",
58
+ "time" => result.elapsed,
59
+ "counts" => {
60
+ "total" => @run_count,
61
+ "pass" => @passes.size,
62
+ "fail" => @failures.size,
63
+ "error" => @errors.size,
64
+ "omit" => 0,
65
+ "todo" => @pendings.size
66
+ }
82
67
  end
83
68
 
69
+ private
70
+
71
+ def log(hash)
72
+ log_str(hash.to_yaml)
73
+ end
84
74
  end
85
75
  end
86
76
  end