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,49 +0,0 @@
1
- module Cucumber
2
- module Ast
3
- class OutlineTable < Table
4
- def initialize(raw, scenario_outline)
5
- super(raw)
6
- @scenario_outline = scenario_outline
7
- @cells_class = ExampleCells
8
- end
9
-
10
- def accept(visitor, status)
11
- cells_rows.each_with_index do |row, n|
12
- should_visit = n == 0 ||
13
- row.at_lines?(visitor.current_feature_lines) ||
14
- @scenario_outline.at_header_or_step_lines?(visitor.current_feature_lines)
15
-
16
- if should_visit
17
- visitor.visit_table_row(row, status)
18
- end
19
- end
20
- nil
21
- end
22
-
23
- def execute_row(cells, visitor, &proc)
24
- @scenario_outline.execute_row(cells, visitor, &proc)
25
- end
26
-
27
- class ExampleCells < Cells
28
- def accept(visitor, status)
29
- if header?
30
- @cells.each do |cell|
31
- visitor.visit_table_cell(cell, :thead)
32
- end
33
- nil
34
- else
35
- exception = @table.execute_row(self, visitor) do |cell, status|
36
- visitor.visit_table_cell(cell, status)
37
- end
38
- end
39
- end
40
-
41
- private
42
-
43
- def header?
44
- index == 0
45
- end
46
- end
47
- end
48
- end
49
- end
@@ -1,52 +0,0 @@
1
- module Cucumber
2
- module Ast
3
- # Represents an inline argument in a step. Example:
4
- #
5
- # Given the message
6
- # """
7
- # I like
8
- # Cucumber sandwich
9
- # """
10
- #
11
- # The text between the pair of <tt>"""</tt> is stored inside a PyString,
12
- # which is yielded to the StepDefinition block as the last argument.
13
- #
14
- # The StepDefinition can then access the String via the #to_s method. In the
15
- # example above, that would return: <tt>"I like\nCucumber sandwich"</tt>
16
- #
17
- # Note how the indentation from the source is stripped away.
18
- #
19
- class PyString
20
- def initialize(start_line, end_line, string, quotes_indent)
21
- @start_line, @end_line = start_line, end_line
22
- @string, @quotes_indent = string.gsub(/\\"/, '"'), quotes_indent
23
- end
24
-
25
- def to_s
26
- @string.indent(-@quotes_indent)
27
- end
28
-
29
- def at_lines?(lines)
30
- lines.detect{|l| l >= @start_line && l <= @end_line}
31
- end
32
-
33
- def accept(visitor, status)
34
- visitor.visit_py_string(to_s, status)
35
- end
36
-
37
- def arguments_replaced(arguments) #:nodoc:
38
- string = @string
39
- arguments.each do |name, value|
40
- string = string.gsub(name, value)
41
- end
42
- PyString.new(@start_line, @end_line, string, @quotes_indent)
43
- end
44
-
45
- # For testing only
46
- def to_sexp #:nodoc:
47
- [:py_string, to_s]
48
- end
49
-
50
- end
51
- end
52
- end
@@ -1,103 +0,0 @@
1
- module Cucumber
2
- module Ast
3
- class Scenario
4
- attr_writer :feature, :background
5
-
6
- def initialize(comment, tags, line, keyword, name, steps)
7
- @comment, @tags, @line, @keyword, @name = comment, tags, line, keyword, name
8
- steps.each {|step| step.scenario = self}
9
- @steps = steps
10
- @steps_helper = Steps.new(self)
11
- end
12
-
13
- def status
14
- @steps.map{|step| step.status}
15
- end
16
-
17
- def tagged_with?(tag_names)
18
- @tags.among?(tag_names) || @feature.tagged_with?(tag_names, false)
19
- end
20
-
21
- def matches_scenario_names?(scenario_names)
22
- scenario_names.detect{|name| @name == name}
23
- end
24
-
25
- def accept(visitor)
26
- visitor.visit_background(@background) if @background
27
- visitor.visit_comment(@comment)
28
- visitor.visit_tags(@tags)
29
- visitor.visit_scenario_name(@keyword, @name, file_line(@line), source_indent(text_length))
30
- visitor.visit_steps(@steps_helper)
31
-
32
- @feature.scenario_executed(self) if @feature && !@executed
33
- @executed = true
34
- end
35
-
36
- def accept_steps(visitor)
37
- prior_world = @background ? @background.world : nil
38
- visitor.world(self, prior_world) do |world|
39
- previous = @background ? @background.status : :passed
40
- @steps.each do |step|
41
- step.previous = previous
42
- step.world = world
43
- visitor.visit_step(step)
44
- previous = step.status
45
- end
46
- end
47
- end
48
-
49
- def source_indent(text_length)
50
- max_line_length - text_length
51
- end
52
-
53
- def max_line_length
54
- lengths = (@steps + [self]).map{|e| e.text_length}
55
- lengths.max
56
- end
57
-
58
- def text_length
59
- @keyword.jlength + @name.jlength
60
- end
61
-
62
- def at_lines?(lines)
63
- at_header_or_step_lines?(lines)
64
- end
65
-
66
- def at_header_or_step_lines?(lines)
67
- lines.empty? || lines.index(@line) || @steps.detect {|step| step.at_lines?(lines)} || @tags.at_lines?(lines)
68
- end
69
-
70
- def undefined?
71
- @steps.empty?
72
- end
73
-
74
- def step_executed(step)
75
- @feature.step_executed(step) if @feature
76
- end
77
-
78
- def backtrace_line(name = "#{@keyword} #{@name}", line = @line)
79
- @feature.backtrace_line(name, line) if @feature
80
- end
81
-
82
- def file_line(line = @line)
83
- @feature.file_line(line) if @feature
84
- end
85
-
86
- def previous_step(step)
87
- i = @steps.index(step) || -1
88
- @steps[i-1]
89
- end
90
-
91
- def to_sexp
92
- sexp = [:scenario, @line, @keyword, @name]
93
- comment = @comment.to_sexp
94
- sexp += [comment] if comment
95
- tags = @tags.to_sexp
96
- sexp += tags if tags.any?
97
- steps = @steps.map{|step| step.to_sexp}
98
- sexp += steps if steps.any?
99
- sexp
100
- end
101
- end
102
- end
103
- end
@@ -1,92 +0,0 @@
1
- module Cucumber
2
- module Ast
3
- class ScenarioOutline < Scenario
4
- # The +example_sections+ argument must be an Array where each element is another array representing
5
- # an Examples section. This array has 3 elements:
6
- #
7
- # * Examples keyword
8
- # * Examples section name
9
- # * Raw matrix
10
- def initialize(comment, tags, line, keyword, name, steps, example_sections)
11
- super(comment, tags, line, keyword, name, steps)
12
- steps.each {|step| step.status = :outline}
13
-
14
- @examples_array = example_sections.map do |example_section|
15
- examples_line = example_section[0]
16
- examples_keyword = example_section[1]
17
- examples_name = example_section[2]
18
- examples_matrix = example_section[3]
19
-
20
- examples_table = OutlineTable.new(examples_matrix, self)
21
- Examples.new(examples_line, examples_keyword, examples_name, examples_table)
22
- end
23
- end
24
-
25
- def at_lines?(lines)
26
- super || @examples_array.detect { |examples| examples.at_lines?(lines) }
27
- end
28
-
29
- def accept(visitor)
30
- visitor.visit_background(@background) if @background
31
- visitor.visit_comment(@comment)
32
- visitor.visit_tags(@tags)
33
- visitor.visit_scenario_name(@keyword, @name, file_line(@line), source_indent(text_length))
34
- visitor.visit_steps(@steps_helper)
35
-
36
- @examples_array.each do |examples|
37
- visitor.visit_examples(examples)
38
- end
39
- end
40
-
41
- def each_example_row(&proc)
42
- @examples_array.each do |examples|
43
- examples.each_example_row(&proc)
44
- end
45
- end
46
-
47
- def execute_row(cells, visitor, &proc)
48
- exception = nil
49
-
50
- prior_world = @background ? @background.world : nil
51
- visitor.world(self, prior_world) do |world|
52
-
53
- previous_status = @background ? @background.status : :passed
54
- argument_hash = cells.to_hash
55
- cell_index = 0
56
- @steps.each do |step|
57
- executed_step, previous_status, matched_args =
58
- step.execute_with_arguments(argument_hash, world, previous_status, visitor, cells[0].line)
59
- # There might be steps that don't have any arguments
60
- # If there are no matched args, we'll still iterate once
61
- matched_args = [nil] if matched_args.empty?
62
-
63
- matched_args.each do
64
- cell = cells[cell_index]
65
- if cell
66
- proc.call(cell, previous_status)
67
- cell_index += 1
68
- end
69
- end
70
- exception ||= executed_step.exception
71
- end
72
- end
73
- @feature.scenario_executed(self) if @feature
74
- exception
75
- end
76
-
77
- def pending? ; false ; end
78
-
79
- def to_sexp
80
- sexp = [:scenario_outline, @keyword, @name]
81
- comment = @comment.to_sexp
82
- sexp += [comment] if comment
83
- tags = @tags.to_sexp
84
- sexp += tags if tags.any?
85
- steps = @steps.map{|step| step.to_sexp}
86
- sexp += steps if steps.any?
87
- sexp += @examples_array.map{|e| e.to_sexp}
88
- sexp
89
- end
90
- end
91
- end
92
- end
@@ -1,161 +0,0 @@
1
- require 'cucumber/step_definition'
2
- require 'cucumber/core_ext/string'
3
-
4
- module Cucumber
5
- module Ast
6
- class Step
7
- attr_reader :keyword, :name
8
- attr_writer :world, :previous, :options
9
- attr_accessor :status, :scenario, :exception
10
-
11
- def initialize(line, keyword, name, *multiline_args)
12
- @line, @keyword, @name, @multiline_args = line, keyword, name, multiline_args
13
- end
14
-
15
- def execute_with_arguments(argument_hash, world, previous, visitor, row_line)
16
- delimited_arguments = delimit_argument_names(argument_hash)
17
- name = replace_name_arguments(delimited_arguments)
18
- multiline_args = replace_multiline_args_arguments(delimited_arguments)
19
-
20
- execute_twin(world, previous, visitor, row_line, name, *multiline_args)
21
- end
22
-
23
- def execute_as_new(world, previous, visitor, row_line)
24
- execute_twin(world, previous, visitor, row_line, @name, *@multiline_args)
25
- end
26
-
27
- def accept(visitor)
28
- execute(visitor)
29
-
30
- if @status == :outline
31
- step_definition = find_first_name_and_step_definition_from_examples(visitor)
32
- else
33
- step_definition = @step_definition
34
- end
35
- visitor.visit_step_name(@keyword, @name, @status, step_definition, source_indent)
36
- @multiline_args.each do |multiline_arg|
37
- visitor.visit_multiline_arg(multiline_arg, @status)
38
- end
39
- @exception
40
- end
41
-
42
- def find_first_name_and_step_definition_from_examples(visitor)
43
- # @scenario is always a ScenarioOutline in this case
44
- @scenario.each_example_row do |cells|
45
- argument_hash = cells.to_hash
46
- delimited_arguments = delimit_argument_names(argument_hash)
47
- name = replace_name_arguments(delimited_arguments)
48
- step_definition = visitor.step_definition(name) rescue nil
49
- return step_definition if step_definition
50
- end
51
- nil
52
- end
53
-
54
- def to_sexp
55
- [:step, @line, @keyword, @name, *@multiline_args.map{|arg| arg.to_sexp}]
56
- end
57
-
58
- def at_lines?(lines)
59
- lines.empty? || lines.index(@line) || @multiline_args.detect{|a| a.at_lines?(lines)}
60
- end
61
-
62
- def source_indent
63
- @scenario.source_indent(text_length)
64
- end
65
-
66
- def text_length
67
- @keyword.jlength + @name.jlength + 2 # Add 2 because steps get indented 2 more than scenarios
68
- end
69
-
70
- def backtrace_line
71
- @backtrace_line ||= @scenario.backtrace_line("#{@keyword} #{@name}", @line) unless @scenario.nil?
72
- end
73
-
74
- def file_line
75
- @file_line ||= @scenario.file_line(@line) unless @scenario.nil?
76
- end
77
-
78
- def actual_keyword
79
- if [Cucumber.keyword_hash['and'], Cucumber.keyword_hash['but']].index(@keyword) && previous_step
80
- previous_step.actual_keyword
81
- else
82
- @keyword
83
- end
84
- end
85
-
86
- protected
87
-
88
- def previous_step
89
- @scenario.previous_step(self)
90
- end
91
-
92
- private
93
-
94
- def execute(visitor)
95
- matched_args = []
96
- if @status.nil?
97
- begin
98
- @step_definition = visitor.step_definition(@name)
99
- matched_args = @step_definition.matched_args(@name)
100
- if @previous == :passed && !visitor.options[:dry_run]
101
- @world.__cucumber_current_step = self
102
- @step_definition.execute(@name, @world, *(matched_args + @multiline_args))
103
- @status = :passed
104
- else
105
- @status = :skipped
106
- end
107
- rescue Undefined => exception
108
- if visitor.options[:strict]
109
- exception.set_backtrace([])
110
- failed(exception)
111
- else
112
- @status = :undefined
113
- end
114
- rescue Pending => exception
115
- visitor.options[:strict] ? failed(exception) : @status = :pending
116
- rescue Exception => exception
117
- failed(exception)
118
- end
119
- @scenario.step_executed(self) if @scenario
120
- end
121
- [self, @status, matched_args]
122
- end
123
-
124
- def execute_twin(world, previous, visitor, line, name, *multiline_args)
125
- # We'll create a new step and execute that
126
- step = Step.new(line, @keyword, name, *multiline_args)
127
- step.scenario = @scenario
128
- step.world = world
129
- step.previous = previous
130
- step.__send__(:execute, visitor)
131
- end
132
-
133
- ARGUMENT_START = '<'
134
- ARGUMENT_END = '>'
135
-
136
- def delimit_argument_names(argument_hash)
137
- argument_hash.inject({}) { |h,(k,v)| h["#{ARGUMENT_START}#{k}#{ARGUMENT_END}"] = v; h }
138
- end
139
-
140
- def replace_name_arguments(argument_hash)
141
- name_with_arguments_replaced = @name
142
- argument_hash.each do |name, value|
143
- name_with_arguments_replaced = name_with_arguments_replaced.gsub(name, value) if value
144
- end
145
- name_with_arguments_replaced
146
- end
147
-
148
- def replace_multiline_args_arguments(arguments)
149
- @multiline_args.map do |arg|
150
- arg.arguments_replaced(arguments)
151
- end
152
- end
153
-
154
- def failed(exception)
155
- @status = :failed
156
- @exception = exception
157
- @exception.backtrace << backtrace_line unless backtrace_line.nil?
158
- end
159
- end
160
- end
161
- end
@@ -1,13 +0,0 @@
1
- module Cucumber
2
- module Ast
3
- class Steps
4
- def initialize(scenario)
5
- @scenario = scenario
6
- end
7
-
8
- def accept(visitor)
9
- @scenario.accept_steps(visitor)
10
- end
11
- end
12
- end
13
- end
@@ -1,218 +0,0 @@
1
- module Cucumber
2
- module Ast
3
- # Holds the data of a table parsed from a feature file:
4
- #
5
- # | a | b |
6
- # | c | d |
7
- #
8
- # This gets parsed into a Table holding the values <tt>[['a', 'b'], ['c', 'd']]</tt>
9
- #
10
- class Table
11
- attr_accessor :file
12
-
13
- def initialize(raw)
14
- # Verify that it's square
15
- raw.transpose
16
- @raw = raw
17
- @cells_class = Cells
18
- @cell_class = Cell
19
- end
20
-
21
- def at_lines?(lines)
22
- cells_rows.detect { |row| row.at_lines?(lines) }
23
- end
24
-
25
- def accept(visitor, status)
26
- cells_rows.each do |row|
27
- visitor.visit_table_row(row, status)
28
- end
29
- nil
30
- end
31
-
32
- # Converts this table into an Array of Hash where the keys of each
33
- # Hash are the headers in the table. For example, a Table built from
34
- # the following plain text:
35
- #
36
- # | a | b | sum |
37
- # | 2 | 3 | 5 |
38
- # | 7 | 9 | 16 |
39
- #
40
- # Gets converted into the following:
41
- #
42
- # [{'a' => '2', 'b' => '3', 'sum' => '5'}, {'a' => '7', 'b' => '9', 'sum' => '16'}]
43
- #
44
- def hashes
45
- @hashes ||= cells_rows[1..-1].map do |row|
46
- row.to_hash
47
- end
48
- end
49
-
50
- # Gets the raw data of this table. For example, a Table built from
51
- # the following plain text:
52
- #
53
- # | a | b |
54
- # | c | d |
55
- #
56
- # Get converted into the following:
57
- #
58
- # [['a', 'b], ['c', 'd']]
59
- #
60
- def raw
61
- @raw
62
- end
63
-
64
- # Same as #raw, but skips the first (header) row
65
- def rows
66
- @raw[1..-1]
67
- end
68
-
69
- def each_cells_row(&proc)
70
- cells_rows.each(&proc)
71
- end
72
-
73
- # For testing only
74
- def to_sexp #:nodoc:
75
- [:table, *cells_rows.map{|row| row.to_sexp}]
76
- end
77
-
78
- def to_hash(cells) #:nodoc:
79
- hash = {}
80
- @raw[0].each_with_index do |key, n|
81
- hash[key] = cells.value(n)
82
- end
83
- hash
84
- end
85
-
86
- def index(cells) #:nodoc:
87
- cells_rows.index(cells)
88
- end
89
-
90
- def arguments_replaced(arguments) #:nodoc:
91
- raw_with_replaced_args = raw.map do |row|
92
- row.map do |cell|
93
- cell_with_replaced_args = cell
94
- arguments.each do |name, value|
95
- cell_with_replaced_args = cell_with_replaced_args.gsub(name, value)
96
- end
97
- cell_with_replaced_args
98
- end
99
- end
100
-
101
- Table.new(raw_with_replaced_args)
102
- end
103
-
104
- def at_lines?(lines)
105
- cells_rows.detect{|row| row.at_lines?(lines)}
106
- end
107
-
108
- private
109
-
110
- def col_width(col)
111
- columns[col].__send__(:width)
112
- end
113
-
114
- def cells_rows
115
- @rows ||= cell_matrix.map do |cell_row|
116
- @cells_class.new(self, cell_row)
117
- end
118
- end
119
-
120
- def columns
121
- @columns ||= cell_matrix.transpose.map do |cell_row|
122
- @cells_class.new(self, cell_row)
123
- end
124
- end
125
-
126
- def cell_matrix
127
- row = -1
128
- @cell_matrix ||= @raw.map do |raw_row|
129
- line = raw_row.line rescue -1
130
- row += 1
131
- col = -1
132
- raw_row.map do |raw_cell|
133
- col += 1
134
- @cell_class.new(raw_cell, self, row, col, line)
135
- end
136
- end
137
- end
138
-
139
- # Represents a row of cells or columns of cells
140
- class Cells
141
- include Enumerable
142
-
143
- def initialize(table, cells)
144
- @table, @cells = table, cells
145
- end
146
-
147
- def accept(visitor, status)
148
- each do |cell|
149
- visitor.visit_table_cell(cell, status)
150
- end
151
- nil
152
- end
153
-
154
- # For testing only
155
- def to_sexp #:nodoc:
156
- [:row, *@cells.map{|cell| cell.to_sexp}]
157
- end
158
-
159
- def to_hash #:nodoc:
160
- @to_hash ||= @table.to_hash(self)
161
- end
162
-
163
- def value(n) #:nodoc:
164
- self[n].value
165
- end
166
-
167
- def [](n)
168
- @cells[n]
169
- end
170
-
171
- def line
172
- @cells[0].line
173
- end
174
-
175
- def at_lines?(lines)
176
- lines.empty? || lines.index(line)
177
- end
178
-
179
- private
180
-
181
- def index
182
- @table.index(self)
183
- end
184
-
185
- def width
186
- map{|cell| cell.value ? cell.value.to_s.jlength : 0}.max
187
- end
188
-
189
- def each(&proc)
190
- @cells.each(&proc)
191
- end
192
- end
193
-
194
- class Cell
195
- attr_reader :value, :line
196
-
197
- def initialize(value, table, row, col, line)
198
- @value, @table, @row, @col, @line = value, table, row, col, line
199
- end
200
-
201
- def accept(visitor, status)
202
- visitor.visit_table_cell_value(@value, col_width, status)
203
- end
204
-
205
- # For testing only
206
- def to_sexp #:nodoc:
207
- [:cell, @value]
208
- end
209
-
210
- private
211
-
212
- def col_width
213
- @col_width ||= @table.__send__(:col_width, @col)
214
- end
215
- end
216
- end
217
- end
218
- end