kosmas58-cucumber 0.1.99.21 → 0.1.99.22

Sign up to get free protection for your applications and to get access to all the features.
Files changed (290) hide show
  1. metadata +17 -300
  2. data/History.txt +0 -513
  3. data/License.txt +0 -20
  4. data/Manifest.txt +0 -0
  5. data/README.txt +0 -4
  6. data/Rakefile +0 -9
  7. data/bin/cucumber +0 -6
  8. data/config/hoe.rb +0 -75
  9. data/config/requirements.rb +0 -15
  10. data/cucumber.yml +0 -3
  11. data/examples/cs/README.textile +0 -1
  12. data/examples/cs/Rakefile +0 -12
  13. data/examples/cs/compile.bat +0 -1
  14. data/examples/cs/features/addition.feature +0 -16
  15. data/examples/cs/features/step_definitons/calculator_steps.rb +0 -19
  16. data/examples/cs/src/demo/Calculator.cs +0 -20
  17. data/examples/dos_line_endings/Rakefile +0 -6
  18. data/examples/dos_line_endings/features/dos_line_endings.feature +0 -9
  19. data/examples/i18n/README.textile +0 -18
  20. data/examples/i18n/Rakefile +0 -32
  21. data/examples/i18n/ar/Rakefile +0 -6
  22. data/examples/i18n/ar/features/addition.feature +0 -17
  23. data/examples/i18n/ar/features/step_definitons/calculator_steps.rb +0 -28
  24. data/examples/i18n/ar/lib/calculator.rb +0 -10
  25. data/examples/i18n/da/Rakefile +0 -6
  26. data/examples/i18n/da/features/step_definitons/kalkulator_steps.rb +0 -24
  27. data/examples/i18n/da/features/summering.feature +0 -17
  28. data/examples/i18n/da/lib/kalkulator.rb +0 -11
  29. data/examples/i18n/de/Rakefile +0 -6
  30. data/examples/i18n/de/features/addition.feature +0 -16
  31. data/examples/i18n/de/features/division.feature +0 -9
  32. data/examples/i18n/de/features/step_definitons/calculator_steps.rb +0 -24
  33. data/examples/i18n/de/lib/calculator.rb +0 -14
  34. data/examples/i18n/en/Rakefile +0 -6
  35. data/examples/i18n/en/features/addition.feature +0 -16
  36. data/examples/i18n/en/features/division.feature +0 -9
  37. data/examples/i18n/en/features/step_definitons/calculator_steps.rb +0 -24
  38. data/examples/i18n/en/lib/calculator.rb +0 -14
  39. data/examples/i18n/es/Rakefile +0 -6
  40. data/examples/i18n/es/features/adicion.feature +0 -16
  41. data/examples/i18n/es/features/step_definitons/calculador_steps.rb +0 -21
  42. data/examples/i18n/es/lib/calculador.rb +0 -14
  43. data/examples/i18n/et/Rakefile +0 -6
  44. data/examples/i18n/et/features/liitmine.feature +0 -17
  45. data/examples/i18n/et/features/step_definitions/kalkulaator_steps.rb +0 -24
  46. data/examples/i18n/et/lib/kalkulaator.rb +0 -10
  47. data/examples/i18n/fi/Rakefile +0 -6
  48. data/examples/i18n/fi/features/jakolasku.feature +0 -9
  49. data/examples/i18n/fi/features/step_definitons/laskin_steps.rb +0 -24
  50. data/examples/i18n/fi/features/yhteenlasku.feature +0 -16
  51. data/examples/i18n/fi/lib/laskin.rb +0 -14
  52. data/examples/i18n/fr/Rakefile +0 -6
  53. data/examples/i18n/fr/features/addition.feature +0 -15
  54. data/examples/i18n/fr/features/step_definitions/calculatrice_steps.rb +0 -27
  55. data/examples/i18n/fr/lib/calculatrice.rb +0 -10
  56. data/examples/i18n/id/Rakefile +0 -6
  57. data/examples/i18n/id/features/addition.feature +0 -16
  58. data/examples/i18n/id/features/division.feature +0 -9
  59. data/examples/i18n/id/features/step_definitons/calculator_steps.rb +0 -24
  60. data/examples/i18n/id/lib/calculator.rb +0 -14
  61. data/examples/i18n/it/Rakefile +0 -6
  62. data/examples/i18n/it/features/somma.feature +0 -10
  63. data/examples/i18n/it/features/step_definitons/calcolatrice_steps.rb +0 -24
  64. data/examples/i18n/it/lib/calcolatrice.rb +0 -11
  65. data/examples/i18n/ja/README.txt +0 -5
  66. data/examples/i18n/ja/Rakefile +0 -6
  67. data/examples/i18n/ja/features/addition.feature +0 -16
  68. data/examples/i18n/ja/features/division.feature +0 -9
  69. data/examples/i18n/ja/features/step_definitons/calculator_steps.rb +0 -24
  70. data/examples/i18n/ja/lib/calculator.rb +0 -14
  71. data/examples/i18n/ko/Rakefile +0 -6
  72. data/examples/i18n/ko/features/addition.feature +0 -16
  73. data/examples/i18n/ko/features/division.feature +0 -10
  74. data/examples/i18n/ko/features/step_definitons/calculator_steps.rb +0 -24
  75. data/examples/i18n/ko/lib/calculator.rb +0 -14
  76. data/examples/i18n/lt/Rakefile +0 -6
  77. data/examples/i18n/lt/features/addition.feature +0 -17
  78. data/examples/i18n/lt/features/division.feature +0 -9
  79. data/examples/i18n/lt/features/step_definitons/calculator_steps.rb +0 -24
  80. data/examples/i18n/lt/lib/calculator.rb +0 -14
  81. data/examples/i18n/no/Rakefile +0 -6
  82. data/examples/i18n/no/features/step_definitons/kalkulator_steps.rb +0 -24
  83. data/examples/i18n/no/features/summering.feature +0 -18
  84. data/examples/i18n/no/lib/kalkulator.rb +0 -11
  85. data/examples/i18n/pt/Rakefile +0 -6
  86. data/examples/i18n/pt/features/adicao.feature +0 -10
  87. data/examples/i18n/pt/features/step_definitions/calculadora_steps.rb +0 -24
  88. data/examples/i18n/pt/lib/calculadora.rb +0 -10
  89. data/examples/i18n/ro/Rakefile +0 -6
  90. data/examples/i18n/ro/features/step_definitons/calculator_steps.rb +0 -24
  91. data/examples/i18n/ro/features/suma.feature +0 -10
  92. data/examples/i18n/ro/lib/calculator.rb +0 -11
  93. data/examples/i18n/se/Rakefile +0 -6
  94. data/examples/i18n/se/features/step_definitons/kalkulator_steps.rb +0 -24
  95. data/examples/i18n/se/features/summering.feature +0 -17
  96. data/examples/i18n/se/lib/kalkulator.rb +0 -11
  97. data/examples/i18n/zh-CN/Rakefile +0 -6
  98. data/examples/i18n/zh-CN/features/addition.feature +0 -17
  99. data/examples/i18n/zh-CN/features/step_definitons/calculator_steps.rb +0 -26
  100. data/examples/i18n/zh-CN/lib/calculator.rb +0 -10
  101. data/examples/java/README.textile +0 -22
  102. data/examples/java/Rakefile +0 -12
  103. data/examples/java/features/hello.feature +0 -11
  104. data/examples/java/features/step_definitons/hello_steps.rb +0 -25
  105. data/examples/java/features/step_definitons/tree_steps.rb +0 -14
  106. data/examples/java/features/tree.feature +0 -9
  107. data/examples/java/src/cucumber/demo/Hello.java +0 -16
  108. data/examples/jbehave/README.textile +0 -17
  109. data/examples/jbehave/features/support/env.rb +0 -7
  110. data/examples/jbehave/features/trading.feature +0 -24
  111. data/examples/jbehave/pom.xml +0 -48
  112. data/examples/jbehave/src/main/java/cukes/jbehave/examples/trader/converters/TraderConverter.java +0 -32
  113. data/examples/jbehave/src/main/java/cukes/jbehave/examples/trader/model/Stock.java +0 -42
  114. data/examples/jbehave/src/main/java/cukes/jbehave/examples/trader/model/Trader.java +0 -29
  115. data/examples/jbehave/src/main/java/cukes/jbehave/examples/trader/persistence/TraderPersister.java +0 -22
  116. data/examples/jbehave/src/main/java/cukes/jbehave/examples/trader/scenarios/TraderSteps.java +0 -65
  117. data/examples/selenium/Rakefile +0 -6
  118. data/examples/selenium/features/search.feature +0 -9
  119. data/examples/selenium/features/step_definitons/stories_steps.rb +0 -40
  120. data/examples/self_test/README.textile +0 -6
  121. data/examples/self_test/Rakefile +0 -6
  122. data/examples/self_test/features/background/failing_background.feature +0 -10
  123. data/examples/self_test/features/background/failing_background_after_success.feature +0 -11
  124. data/examples/self_test/features/background/multiline_args_background.feature +0 -32
  125. data/examples/self_test/features/background/passing_background.feature +0 -10
  126. data/examples/self_test/features/background/pending_background.feature +0 -10
  127. data/examples/self_test/features/background/scenario_outline_failing_background.feature +0 -16
  128. data/examples/self_test/features/background/scenario_outline_passing_background.feature +0 -16
  129. data/examples/self_test/features/call_undefined_step_from_step_def.feature +0 -7
  130. data/examples/self_test/features/lots_of_undefined.feature +0 -8
  131. data/examples/self_test/features/outline_sample.feature +0 -15
  132. data/examples/self_test/features/sample.feature +0 -19
  133. data/examples/self_test/features/step_definitions/sample_steps.rb +0 -62
  134. data/examples/self_test/features/support/env.rb +0 -1
  135. data/examples/self_test/features/support/tag_count_formatter.rb +0 -25
  136. data/examples/test_unit/Rakefile +0 -6
  137. data/examples/test_unit/features/step_definitions/test_unit_steps.rb +0 -26
  138. data/examples/test_unit/features/test_unit.feature +0 -9
  139. data/examples/tickets/Rakefile +0 -11
  140. data/examples/tickets/cucumber.yml +0 -2
  141. data/examples/tickets/features/172.feature +0 -28
  142. data/examples/tickets/features/177/1.feature +0 -29
  143. data/examples/tickets/features/177/2.feature +0 -21
  144. data/examples/tickets/features/177/3.feature +0 -18
  145. data/examples/tickets/features/180.feature +0 -7
  146. data/examples/tickets/features/lib/eatting_machine.rb +0 -18
  147. data/examples/tickets/features/lib/pantry.rb +0 -20
  148. data/examples/tickets/features/scenario_outline.feature +0 -95
  149. data/examples/tickets/features/step_definitons/scenario_outline_steps.rb +0 -42
  150. data/examples/tickets/features/step_definitons/tickets_steps.rb +0 -60
  151. data/examples/tickets/features/tickets.feature +0 -28
  152. data/examples/watir/README.textile +0 -16
  153. data/examples/watir/Rakefile +0 -6
  154. data/examples/watir/features/search.feature +0 -9
  155. data/examples/watir/features/step_definitons/search_steps.rb +0 -24
  156. data/examples/watir/features/support/env.rb +0 -32
  157. data/features/background.feature +0 -223
  158. data/features/cucumber_cli.feature +0 -343
  159. data/features/cucumber_cli_outlines.feature +0 -90
  160. data/features/custom_formatter.feature +0 -11
  161. data/features/report_called_undefined_steps.feature +0 -32
  162. data/features/step_definitions/cucumber_steps.rb +0 -31
  163. data/features/step_definitions/extra_steps.rb +0 -2
  164. data/features/support/env.rb +0 -8
  165. data/gem_tasks/deployment.rake +0 -11
  166. data/gem_tasks/environment.rake +0 -7
  167. data/gem_tasks/features.rake +0 -9
  168. data/gem_tasks/fix_cr_lf.rake +0 -10
  169. data/gem_tasks/flog.rake +0 -4
  170. data/gem_tasks/gemspec.rake +0 -10
  171. data/gem_tasks/jar.rake +0 -67
  172. data/gem_tasks/rspec.rake +0 -38
  173. data/gem_tasks/yard.rake +0 -8
  174. data/lib/autotest/cucumber.rb +0 -6
  175. data/lib/autotest/cucumber_mixin.rb +0 -124
  176. data/lib/autotest/cucumber_rails.rb +0 -6
  177. data/lib/autotest/cucumber_rails_rspec.rb +0 -6
  178. data/lib/autotest/cucumber_rspec.rb +0 -6
  179. data/lib/autotest/discover.rb +0 -9
  180. data/lib/cucumber/ast/background.rb +0 -88
  181. data/lib/cucumber/ast/comment.rb +0 -26
  182. data/lib/cucumber/ast/examples.rb +0 -26
  183. data/lib/cucumber/ast/feature.rb +0 -66
  184. data/lib/cucumber/ast/features.rb +0 -39
  185. data/lib/cucumber/ast/filter.rb +0 -22
  186. data/lib/cucumber/ast/outline_table.rb +0 -49
  187. data/lib/cucumber/ast/py_string.rb +0 -52
  188. data/lib/cucumber/ast/scenario.rb +0 -103
  189. data/lib/cucumber/ast/scenario_outline.rb +0 -92
  190. data/lib/cucumber/ast/step.rb +0 -161
  191. data/lib/cucumber/ast/steps.rb +0 -13
  192. data/lib/cucumber/ast/table.rb +0 -218
  193. data/lib/cucumber/ast/tags.rb +0 -40
  194. data/lib/cucumber/ast/visitor.rb +0 -109
  195. data/lib/cucumber/ast.rb +0 -29
  196. data/lib/cucumber/broadcaster.rb +0 -15
  197. data/lib/cucumber/cli/configuration.rb +0 -339
  198. data/lib/cucumber/cli/language_help_formatter.rb +0 -59
  199. data/lib/cucumber/cli/main.rb +0 -100
  200. data/lib/cucumber/core_ext/exception.rb +0 -53
  201. data/lib/cucumber/core_ext/instance_exec.rb +0 -54
  202. data/lib/cucumber/core_ext/proc.rb +0 -33
  203. data/lib/cucumber/core_ext/string.rb +0 -48
  204. data/lib/cucumber/formatter/ansicolor.rb +0 -103
  205. data/lib/cucumber/formatter/color_io.rb +0 -17
  206. data/lib/cucumber/formatter/console.rb +0 -119
  207. data/lib/cucumber/formatter/cucumber.css +0 -55
  208. data/lib/cucumber/formatter/cucumber.sass +0 -49
  209. data/lib/cucumber/formatter/html.rb +0 -121
  210. data/lib/cucumber/formatter/pretty.rb +0 -167
  211. data/lib/cucumber/formatter/profile.rb +0 -77
  212. data/lib/cucumber/formatter/progress.rb +0 -68
  213. data/lib/cucumber/formatter/rerun.rb +0 -35
  214. data/lib/cucumber/formatter/unicode.rb +0 -35
  215. data/lib/cucumber/formatter.rb +0 -1
  216. data/lib/cucumber/formatters/unicode.rb +0 -2
  217. data/lib/cucumber/jbehave.rb +0 -102
  218. data/lib/cucumber/languages.yml +0 -339
  219. data/lib/cucumber/parser/basic.rb +0 -0
  220. data/lib/cucumber/parser/feature.rb +0 -1490
  221. data/lib/cucumber/parser/feature.tt +0 -188
  222. data/lib/cucumber/parser/i18n.tt +0 -31
  223. data/lib/cucumber/parser/table.rb +0 -402
  224. data/lib/cucumber/parser/table.tt +0 -59
  225. data/lib/cucumber/parser/treetop_ext.rb +0 -75
  226. data/lib/cucumber/parser.rb +0 -43
  227. data/lib/cucumber/platform.rb +0 -18
  228. data/lib/cucumber/rails/rspec.rb +0 -8
  229. data/lib/cucumber/rails/world.rb +0 -73
  230. data/lib/cucumber/rake/task.rb +0 -111
  231. data/lib/cucumber/step_definition.rb +0 -87
  232. data/lib/cucumber/step_mother.rb +0 -183
  233. data/lib/cucumber/version.rb +0 -10
  234. data/lib/cucumber.rb +0 -71
  235. data/rails_generators/cucumber/USAGE +0 -14
  236. data/rails_generators/cucumber/cucumber_generator.rb +0 -54
  237. data/rails_generators/cucumber/templates/cucumber +0 -8
  238. data/rails_generators/cucumber/templates/cucumber.rake +0 -12
  239. data/rails_generators/cucumber/templates/env.rb +0 -16
  240. data/rails_generators/cucumber/templates/paths.rb +0 -12
  241. data/rails_generators/cucumber/templates/webrat_steps.rb +0 -99
  242. data/rails_generators/feature/USAGE +0 -15
  243. data/rails_generators/feature/feature_generator.rb +0 -60
  244. data/rails_generators/feature/templates/feature.erb +0 -31
  245. data/rails_generators/feature/templates/steps.erb +0 -24
  246. data/spec/cucumber/ast/background_spec.rb +0 -58
  247. data/spec/cucumber/ast/feature_factory.rb +0 -54
  248. data/spec/cucumber/ast/feature_spec.rb +0 -60
  249. data/spec/cucumber/ast/py_string_spec.rb +0 -40
  250. data/spec/cucumber/ast/scenario_outline_spec.rb +0 -64
  251. data/spec/cucumber/ast/scenario_spec.rb +0 -82
  252. data/spec/cucumber/ast/step_spec.rb +0 -45
  253. data/spec/cucumber/ast/table_spec.rb +0 -81
  254. data/spec/cucumber/ast/tags_spec.rb +0 -23
  255. data/spec/cucumber/broadcaster_spec.rb +0 -14
  256. data/spec/cucumber/cli/configuration_spec.rb +0 -239
  257. data/spec/cucumber/cli/main_spec.rb +0 -164
  258. data/spec/cucumber/core_ext/proc_spec.rb +0 -37
  259. data/spec/cucumber/core_ext/string_spec.rb +0 -42
  260. data/spec/cucumber/formatter/ansicolor_spec.rb +0 -35
  261. data/spec/cucumber/formatter/html/cucumber.css +0 -37
  262. data/spec/cucumber/formatter/html/cucumber.js +0 -13
  263. data/spec/cucumber/formatter/html/index.html +0 -45
  264. data/spec/cucumber/formatter/html/jquery-1.3.min.js +0 -19
  265. data/spec/cucumber/formatter/html/jquery.uitableedit.js +0 -100
  266. data/spec/cucumber/formatters/profile_formatter_spec.rb +0 -198
  267. data/spec/cucumber/parser/feature_parser_spec.rb +0 -281
  268. data/spec/cucumber/parser/table_parser_spec.rb +0 -48
  269. data/spec/cucumber/rails/stubs/mini_rails.rb +0 -18
  270. data/spec/cucumber/rails/stubs/test_help.rb +0 -1
  271. data/spec/cucumber/rails/world_spec.rb +0 -11
  272. data/spec/cucumber/sell_cucumbers.feature +0 -19
  273. data/spec/cucumber/step_definition_spec.rb +0 -62
  274. data/spec/cucumber/step_mother_spec.rb +0 -73
  275. data/spec/cucumber/treetop_parser/empty_feature.feature +0 -4
  276. data/spec/cucumber/treetop_parser/empty_scenario.feature +0 -9
  277. data/spec/cucumber/treetop_parser/empty_scenario_outline.feature +0 -3
  278. data/spec/cucumber/treetop_parser/fit_scenario.feature +0 -8
  279. data/spec/cucumber/treetop_parser/given_scenario.feature +0 -9
  280. data/spec/cucumber/treetop_parser/invalid_scenario_outlines.feature +0 -7
  281. data/spec/cucumber/treetop_parser/multiline_steps.feature +0 -17
  282. data/spec/cucumber/treetop_parser/multiple_tables.feature +0 -27
  283. data/spec/cucumber/treetop_parser/scenario_outline.feature +0 -16
  284. data/spec/cucumber/treetop_parser/spaces.feature +0 -12
  285. data/spec/cucumber/treetop_parser/test_dos.feature +0 -25
  286. data/spec/cucumber/treetop_parser/with_comments.feature +0 -10
  287. data/spec/cucumber/treetop_parser/with_tags.feature +0 -18
  288. data/spec/cucumber/world/pending_spec.rb +0 -47
  289. data/spec/spec.opts +0 -3
  290. data/spec/spec_helper.rb +0 -21
@@ -1,167 +0,0 @@
1
- require 'cucumber/formatter/console'
2
- require 'fileutils'
3
-
4
- module Cucumber
5
- module Formatter
6
- # This formatter prints features to plain text - exactly how they were parsed,
7
- # just prettier. That means with proper indentation and alignment of table columns.
8
- #
9
- # If the output is STDOUT (and not a file), there are bright colours to watch too.
10
- #
11
- class Pretty < Ast::Visitor
12
- include FileUtils
13
- include Console
14
- attr_writer :indent
15
-
16
- def initialize(step_mother, io, options, delim='|')
17
- super(step_mother)
18
- @io = io
19
- @options = options
20
- @delim = delim
21
- @indent = 0
22
- end
23
-
24
- def visit_features(features)
25
- super
26
- print_summary(features) unless @options[:autoformat]
27
- end
28
-
29
- def visit_feature(feature)
30
- @indent = 0
31
- if @options[:autoformat]
32
- file = File.join(@options[:autoformat], feature.file)
33
- dir = File.dirname(file)
34
- mkdir_p(dir) unless File.directory?(dir)
35
- File.open(file, Cucumber.file_mode('w')) do |io|
36
- @io = io
37
- with_color do
38
- feature.accept(self)
39
- end
40
- end
41
- else
42
- with_color do
43
- feature.accept(self)
44
- end
45
- end
46
- end
47
-
48
- def visit_comment(comment)
49
- comment.accept(self)
50
- end
51
-
52
- def visit_comment_line(comment_line)
53
- unless comment_line.blank?
54
- @io.puts(comment_line.indent(@indent))
55
- @io.flush
56
- end
57
- end
58
-
59
- def visit_tags(tags)
60
- tags.accept(self)
61
- if @indent == 1
62
- @io.puts
63
- @io.flush
64
- end
65
- end
66
-
67
- def visit_tag_name(tag_name)
68
- tag = format_string("@#{tag_name}", :tag).indent(@indent)
69
- @io.print(tag)
70
- @io.flush
71
- @indent = 1
72
- end
73
-
74
- def visit_feature_name(name)
75
- @io.puts(name)
76
- @io.puts
77
- @io.flush
78
- end
79
-
80
- def visit_feature_element(feature_element)
81
- @indent = 2
82
- @last_undefined = feature_element.undefined?
83
- feature_element.accept(self)
84
- @io.puts
85
- @io.flush
86
- end
87
-
88
- def visit_background(background)
89
- @indent = 2
90
- background_already_visible = background.already_visited_steps?
91
- background.accept(self)
92
- @io.puts unless background_already_visible
93
- end
94
-
95
- def visit_examples(examples)
96
- examples.accept(self)
97
- end
98
-
99
- def visit_examples_name(keyword, name)
100
- @io.puts("\n #{keyword} #{name}")
101
- @io.flush
102
- @indent = 4
103
- end
104
-
105
- def visit_scenario_name(keyword, name, file_line, source_indent)
106
- line = " #{keyword} #{name}"
107
- line = format_string(line, :undefined) if @last_undefined
108
- @io.print(line)
109
- if @options[:source]
110
- line_comment = " # #{file_line}".indent(source_indent)
111
- @io.print(format_string(line_comment, :comment))
112
- end
113
- @io.puts
114
- @io.flush
115
- end
116
-
117
- def visit_step(step)
118
- @indent = 6
119
- exception = step.accept(self)
120
- print_exception(exception, @indent) if exception
121
- end
122
-
123
- def visit_step_name(keyword, step_name, status, step_definition, source_indent)
124
- source_indent = nil unless @options[:source]
125
- formatted_step_name = format_step(keyword, step_name, status, step_definition, source_indent)
126
- @io.puts(" " + formatted_step_name)
127
- @io.flush
128
- end
129
-
130
- def visit_multiline_arg(multiline_arg, status)
131
- return if @options[:no_multiline]
132
- multiline_arg.accept(self, status)
133
- end
134
-
135
- def visit_table_row(table_row, status)
136
- @io.print @delim.indent(@indent)
137
- exception = table_row.accept(self, status)
138
- @io.puts
139
- print_exception(exception, 6) if exception
140
- end
141
-
142
- def visit_py_string(string, status)
143
- s = "\"\"\"\n#{string}\n\"\"\"".indent(@indent)
144
- s = s.split("\n").map{|l| l =~ /^\s+$/ ? '' : l}.join("\n")
145
- @io.puts(format_string(s, status))
146
- @io.flush
147
- end
148
-
149
- def visit_table_cell(table_cell, status)
150
- table_cell.accept(self, status)
151
- end
152
-
153
- def visit_table_cell_value(value, width, status)
154
- @io.print(' ' + format_string((value.to_s || '').ljust(width), status) + " #{@delim}")
155
- @io.flush
156
- end
157
-
158
- private
159
-
160
- def print_summary(features)
161
- print_counts(features)
162
- print_snippets(features, @options)
163
- end
164
-
165
- end
166
- end
167
- end
@@ -1,77 +0,0 @@
1
- require 'cucumber/formatter/progress'
2
-
3
- module Cucumber
4
- module Formatter
5
- class Profile < Progress
6
- NUMBER_OF_STEP_DEFINITONS_TO_SHOW = 10
7
- NUMBER_OF_STEP_INVOCATIONS_TO_SHOW = 5
8
-
9
- def initialize(step_mother, io, options)
10
- super
11
- @step_definition_durations = Hash.new { |h,step_definition| h[step_definition] = [] }
12
- end
13
-
14
- def visit_step(step)
15
- @step_duration = Time.now
16
- @step = step
17
- super
18
- end
19
-
20
- def visit_step_name(keyword, step_name, status, step_definition, source_indent)
21
- duration = Time.now - @step_duration
22
- super
23
-
24
- if step_definition # nil for outline steps
25
- description = format_step(keyword, step_name, status, step_definition, nil)
26
- @step_definition_durations[step_definition] << [duration, description, @step.file_line]
27
- end
28
- end
29
-
30
- def print_summary(features)
31
- super
32
- @io.puts "\n\nTop #{NUMBER_OF_STEP_DEFINITONS_TO_SHOW} average slowest steps with #{NUMBER_OF_STEP_INVOCATIONS_TO_SHOW} slowest matches:\n"
33
-
34
- mean_durations = map_to_mean_durations(@step_definition_durations)
35
- mean_durations = mean_durations.sort_by do |duration_description_location, step_definition, mean_duration|
36
- mean_duration
37
- end.reverse
38
-
39
- mean_durations[0...NUMBER_OF_STEP_DEFINITONS_TO_SHOW].each do |duration_description_location, step_definition, mean_duration|
40
- print_step_definition(step_definition, mean_duration)
41
- duration_description_location = duration_description_location.sort_by do |duration, description, location|
42
- duration
43
- end.reverse
44
- print_step_definitions(duration_description_location, step_definition)
45
- end
46
- end
47
-
48
- private
49
-
50
- def map_to_mean_durations(step_definition_durations)
51
- mean_durations = []
52
- step_definition_durations.each do |step_definition, duration_description_location|
53
- total_duration = duration_description_location.inject(0) { |sum, step_details| step_details[0] + sum }
54
- mean_duration = total_duration / duration_description_location.length
55
-
56
- mean_durations << [duration_description_location, step_definition, mean_duration]
57
- end
58
- mean_durations
59
- end
60
-
61
- def print_step_definition(step_definition, mean_duration)
62
- duration = sprintf("%.7f", mean_duration)
63
- @io.puts format_string("#{duration} #{step_definition.to_backtrace_line}", :failed)
64
- end
65
-
66
- def print_step_definitions(duration_description_location, step_definition)
67
- max_length = duration_description_location[0...NUMBER_OF_STEP_INVOCATIONS_TO_SHOW].map{|_, d, _| d.jlength}.max
68
- duration_description_location[0...NUMBER_OF_STEP_INVOCATIONS_TO_SHOW].each do |duration, description, location|
69
- @io.print format_string(" #{sprintf("%.7f", duration)}", :pending)
70
- @io.print " #{description}"
71
- @io.print format_string(" # #{location}".indent(max_length - description.jlength), :comment)
72
- @io.puts
73
- end
74
- end
75
- end
76
- end
77
- end
@@ -1,68 +0,0 @@
1
- require 'cucumber/formatter/console'
2
-
3
- module Cucumber
4
- module Formatter
5
- class Progress < Ast::Visitor
6
- include Console
7
-
8
- def initialize(step_mother, io, options)
9
- super(step_mother)
10
- @io = io
11
- @options = options
12
- end
13
-
14
- def visit_features(features)
15
- with_color do
16
- super
17
- @io.puts
18
- @io.puts
19
- print_summary(features)
20
- end
21
- end
22
-
23
- def visit_multiline_arg(multiline_arg, status)
24
- @multiline_arg = true
25
- super
26
- @multiline_arg = false
27
- end
28
-
29
- def visit_feature_element(feature_element)
30
- progress(:undefined) if feature_element.undefined?
31
- super
32
- end
33
-
34
- def visit_step_name(keyword, step_name, status, step_definition, source_indent)
35
- progress(status) unless status == :outline
36
- end
37
-
38
- def visit_table_cell_value(value, width, status)
39
- progress(status) if (status != :thead) && !@multiline_arg
40
- end
41
-
42
- private
43
-
44
- def print_summary(features)
45
- print_undefined_scenarios(features)
46
- print_steps(features, :pending)
47
- print_steps(features, :failed)
48
- print_counts(features)
49
- print_snippets(features, @options)
50
- end
51
-
52
- CHARS = {
53
- :passed => '.',
54
- :failed => 'F',
55
- :undefined => 'U',
56
- :pending => 'P',
57
- :skipped => 'S'
58
- }
59
-
60
- def progress(status)
61
- char = CHARS[status]
62
- @io.print(format_string(char, status))
63
- @io.flush
64
- end
65
-
66
- end
67
- end
68
- end
@@ -1,35 +0,0 @@
1
- module Cucumber
2
- module Formatter
3
- class Rerun < Ast::Visitor
4
- def initialize(step_mother, io, options)
5
- super(step_mother)
6
- @io = io
7
- @file_names = []
8
- @file_lines = Hash.new{|h,k| h[k] = []}
9
- end
10
-
11
- def visit_features(features)
12
- super
13
- files = @file_names.uniq.map do |file|
14
- lines = @file_lines[file]
15
- "#{file}:#{lines.join(':')}"
16
- end
17
- @io.puts files.join(' ')
18
- end
19
-
20
- def visit_feature_element(feature_element)
21
- @rerun = false
22
- super
23
- if @rerun
24
- file, line = *feature_element.file_line.split(':')
25
- @file_lines[file] << line
26
- @file_names << file
27
- end
28
- end
29
-
30
- def visit_step_name(keyword, step_name, status, step_definition, source_indent)
31
- @rerun = true if [:failed].index(status)
32
- end
33
- end
34
- end
35
- end
@@ -1,35 +0,0 @@
1
- # Require this file if you need Unicode support.
2
- require 'cucumber/platform'
3
- require 'cucumber/formatter/ansicolor'
4
-
5
- $KCODE='u' unless Cucumber::RUBY_1_9
6
-
7
- if Cucumber::WINDOWS_MRI && `chcp` =~ /(\d+)/
8
- codepage = $1.to_i
9
- codepages = (1251..1252)
10
-
11
- if codepages.include?(codepage)
12
- Cucumber::CODEPAGE = "cp#{codepage}"
13
-
14
- require 'iconv'
15
- module Kernel
16
- alias cucumber_print print
17
- def print(*a)
18
- begin
19
- cucumber_print(*Iconv.iconv(Cucumber::CODEPAGE, "UTF-8", *a))
20
- rescue Iconv::IllegalSequence
21
- cucumber_print(*a)
22
- end
23
- end
24
-
25
- alias cucumber_puts puts
26
- def puts(*a)
27
- begin
28
- cucumber_puts(*Iconv.iconv(Cucumber::CODEPAGE, "UTF-8", *a))
29
- rescue Iconv::IllegalSequence
30
- cucumber_puts(*a)
31
- end
32
- end
33
- end
34
- end
35
- end
@@ -1 +0,0 @@
1
- %w{color_io pretty progress profile rerun html}.each{|n| require "cucumber/formatter/#{n}"}
@@ -1,2 +0,0 @@
1
- # This is for backwards compatibility
2
- require 'cucumber/formatter/unicode'
@@ -1,102 +0,0 @@
1
- if defined?(JRUBY_VERSION)
2
- require 'java'
3
-
4
- Exception::CUCUMBER_FILTER_PATTERNS.unshift(/^org\/jruby|^org\/jbehave|^org\/junit|^java\/|^sun\/|^\$_dot_dot_/)
5
-
6
- module Cucumber
7
- module JBehave
8
- # Register an instance of org.jbehave.scenario.steps.Steps
9
- def JBehave(jbehave_steps)
10
- jbehave_steps.getSteps.each do |jbehave_candidate_step|
11
- step_definitions << JBehaveStepDefinition.new(jbehave_steps, jbehave_candidate_step)
12
- end
13
- end
14
-
15
- # Open up so we can get the pattern....
16
- JBehaveCandidateStep = org.jbehave.scenario.steps.CandidateStep
17
- class JBehaveCandidateStep
18
- field_reader :pattern
19
- end
20
-
21
- # Adapter for JBehave org.jbehave.scenario.steps.CandidateStep
22
- class JBehaveStepDefinition
23
- def initialize(jbehave_steps, jbehave_candidate_step)
24
- @jbehave_steps = jbehave_steps
25
- @jbehave_candidate_step = jbehave_candidate_step
26
- end
27
-
28
- def match(step_name)
29
- full_text = "Given #{step_name}" # JBehave doesn't distinguish GWT internally :-)
30
- @jbehave_candidate_step.matches(full_text)
31
- end
32
-
33
- def file_colon_line
34
- @jbehave_steps.java_class.name
35
- end
36
-
37
- def format_args(step_name, format)
38
- java_pattern = @jbehave_candidate_step.pattern.pattern
39
- regexp = Regexp.new(java_pattern)
40
- step_name.gzub(regexp, format)
41
- end
42
-
43
- def matched_args(step_name)
44
- java_pattern = @jbehave_candidate_step.pattern.pattern
45
- regexp = Regexp.new(java_pattern)
46
- step_name.match(regexp).captures
47
- end
48
-
49
- def execute(step_name, world, *args)
50
- step = @jbehave_candidate_step.createFrom("Given #{step_name}")
51
- result = step.perform
52
- result.describeTo(JBehave::REPORTER)
53
- end
54
- end
55
-
56
- class JBehaveException < Exception
57
- end
58
-
59
- # Implements the org.jbehave.scenario.reporters.ScenarioReporter methods
60
- class Reporter
61
- def successful(step_text)
62
- # noop
63
- end
64
-
65
- def failed(step, java_exception)
66
- raise java_exception_to_ruby_exception(java_exception)
67
- end
68
-
69
- private
70
-
71
- def java_exception_to_ruby_exception(java_exception)
72
- # OK, this is a little funky - JRuby weirdness
73
- ruby_exception = org.jruby.NativeException.new(JRuby.runtime, JBehaveException, java_exception)
74
- ruby_exception.set_backtrace([]) # work around backtrace bug in jruby
75
-
76
- exception = JBehaveException.new(java_exception.getMessage)
77
- bt = ruby_exception.backtrace
78
- Exception.cucumber_strip_backtrace!(bt, nil, nil)
79
- exception.set_backtrace(bt)
80
- exception
81
- end
82
- end
83
-
84
- REPORTER = Reporter.new
85
-
86
- def self.snippet_text(step_keyword, step_name)
87
- camel = step_name.gsub(/(\s.)/) {$1.upcase.strip}
88
- method = camel[0..0].downcase + camel[1..-1]
89
- snippet = %{ @#{step_keyword}("#{step_name}")
90
- public void #{method}() {
91
- throw new RuntimeException("pending");
92
- }}
93
- end
94
- end
95
- end
96
-
97
- self.extend(Cucumber::JBehave)
98
- self.snippet_generator = Cucumber::JBehave
99
- else
100
- STDERR.puts "ERROR: cucumber/jbehave only works with JRuby"
101
- Kernel.exit(1)
102
- end