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,75 +0,0 @@
1
- begin
2
- require 'treetop'
3
- require 'treetop/runtime'
4
- require 'treetop/ruby_extensions'
5
- rescue LoadError
6
- require "rubygems"
7
- gem "treetop"
8
- require 'treetop'
9
- require 'treetop/runtime'
10
- require 'treetop/ruby_extensions'
11
- end
12
-
13
- module Cucumber
14
- module Parser
15
- module TreetopExt
16
- FILE_LINE_PATTERN = /^([\w\W]*?):([\d:]+)$/
17
-
18
- # Parses a file and returns a Cucumber::Ast
19
- def parse_file(file)
20
- _, path, lines = *FILE_LINE_PATTERN.match(file)
21
- if path
22
- lines = lines.split(':').map { |line| line.to_i }
23
- else
24
- path = file
25
- lines = []
26
- end
27
-
28
- loader = lambda { |io| parse_or_fail(io.read, path) }
29
- feature = if path =~ /^http/
30
- require 'open-uri'
31
- open(path, &loader)
32
- else
33
- File.open(path, Cucumber.file_mode('r'), &loader)
34
- end
35
- feature.lines = lines
36
- feature
37
- end
38
- end
39
-
40
- class SyntaxError < StandardError
41
- def initialize(parser, file, line_offset)
42
- tf = parser.terminal_failures
43
- expected = tf.size == 1 ? tf[0].expected_string.inspect : "one of #{tf.map{|f| f.expected_string.inspect}.uniq*', '}"
44
- line = parser.failure_line + line_offset
45
- message = "#{file}:#{line}:#{parser.failure_column}: Parse error, expected #{expected}."
46
- super(message)
47
- end
48
- end
49
- end
50
- end
51
-
52
- module Treetop
53
- module Runtime
54
- class SyntaxNode
55
- def line
56
- input.line_of(interval.first)
57
- end
58
- end
59
-
60
- class CompiledParser
61
- include Cucumber::Parser::TreetopExt
62
-
63
- def parse_or_fail(s, file=nil, line=0)
64
- parse_tree = parse(s)
65
- if parse_tree.nil?
66
- raise Cucumber::Parser::SyntaxError.new(self, file, line)
67
- else
68
- ast = parse_tree.build
69
- ast.file = file
70
- ast
71
- end
72
- end
73
- end
74
- end
75
- end
@@ -1,43 +0,0 @@
1
- require 'erb'
2
- require 'cucumber/platform'
3
- require 'cucumber/ast'
4
- require 'cucumber/parser/treetop_ext'
5
- require 'cucumber/parser/table'
6
-
7
- module Cucumber
8
- # Classes in this module parse feature files and translate the parse tree
9
- # (concrete syntax tree) into an abstract syntax tree (AST) using
10
- # <a href="http://martinfowler.com/dslwip/EmbeddedTranslation.html">Embedded translation</a>.
11
- #
12
- # The AST is built by the various <tt>#build</tt> methods in the parse tree.
13
- #
14
- # The AST classes are defined in the Cucumber::Ast module.
15
- module Parser
16
- translator = Module.new do
17
- def keywordz(key)
18
- 'Scenario'
19
- end
20
- end
21
-
22
- def self.load_parser(keywords)
23
- Loader.new(keywords)
24
- end
25
-
26
- class Loader
27
- def initialize(keywords)
28
- @keywords = keywords
29
- i18n_tt = File.expand_path(File.dirname(__FILE__) + '/parser/i18n.tt')
30
- template = File.open(i18n_tt, Cucumber.file_mode('r')).read
31
- erb = ERB.new(template)
32
- grammar = erb.result(binding)
33
- Treetop.load_from_string(grammar)
34
- require 'cucumber/parser/feature'
35
- end
36
-
37
- def keywords(key)
38
- values = @keywords[key].split('|')
39
- values.map{|value| "'#{value}'"}.join(" / ")
40
- end
41
- end
42
- end
43
- end
@@ -1,18 +0,0 @@
1
- # Detect the platform we're running on so we can tweak behaviour
2
- # in various places.
3
- require 'rbconfig'
4
- require 'yaml'
5
-
6
- module Cucumber
7
- LANGUAGE_FILE = File.expand_path(File.dirname(__FILE__) + '/languages.yml')
8
- LANGUAGES = YAML.load_file(LANGUAGE_FILE)
9
- BINARY = File.expand_path(File.dirname(__FILE__) + '/../../bin/cucumber')
10
- JRUBY = defined?(JRUBY_VERSION)
11
- IRONRUBY = Config::CONFIG['sitedir'] =~ /IronRuby/
12
- WINDOWS = Config::CONFIG['host_os'] =~ /mswin|mingw/
13
- WINDOWS_MRI = WINDOWS && !JRUBY && !IRONRUBY
14
- RAILS = defined?(Rails)
15
- RUBY_BINARY = File.join(Config::CONFIG['bindir'], Config::CONFIG['ruby_install_name'])
16
- RUBY_1_9 = RUBY_VERSION =~ /^1\.9/
17
- EXCEPTION_STATUS = Hash.new(:failed)
18
- end
@@ -1,8 +0,0 @@
1
- require 'cucumber/rails/world'
2
- require 'spec/expectations'
3
- require 'spec/rails/matchers'
4
-
5
- Cucumber::Rails::World.class_eval do
6
- include Spec::Matchers
7
- include Spec::Rails::Matchers
8
- end
@@ -1,73 +0,0 @@
1
- # Based on code from Brian Takita, Yurii Rashkovskii and Ben Mabey
2
- # Adapted by Aslak Hellesøy
3
-
4
- if defined?(ActiveRecord::Base)
5
- require 'test_help'
6
- else
7
- require 'action_controller/test_process'
8
- require 'action_controller/integration'
9
- end
10
- require 'test/unit/testresult'
11
-
12
- # These allow exceptions to come through as opposed to being caught and having non-helpful responses returned.
13
- ActionController::Base.class_eval do
14
- def perform_action_with_rescue
15
- perform_action_without_rescue
16
- end
17
- end
18
- ActionController::Dispatcher.class_eval do
19
- def self.failsafe_response(output, status, exception = nil)
20
- raise exception
21
- end
22
- end
23
-
24
- # So that Test::Unit doesn't launch at the end - makes it think it has already been run.
25
- Test::Unit.run = true if Test::Unit.respond_to?(:run=)
26
-
27
- $cucumber_toplevel = self
28
-
29
- module Cucumber #:nodoc:
30
- module Rails
31
- # All scenarios will execute in the context of a new instance of World.
32
- class World < ActionController::IntegrationTest
33
- if defined?(ActiveRecord::Base)
34
- self.use_transactional_fixtures = false
35
- else
36
- def self.fixture_table_names; []; end # Workaround for projects that don't use ActiveRecord
37
- end
38
-
39
- def initialize #:nodoc:
40
- @_result = Test::Unit::TestResult.new
41
- end
42
- end
43
-
44
- def self.use_transactional_fixtures
45
- World.use_transactional_fixtures = true
46
- if defined?(ActiveRecord::Base)
47
- $cucumber_toplevel.Before do
48
- if ActiveRecord::Base.connection.respond_to?(:increment_open_transactions)
49
- ActiveRecord::Base.connection.increment_open_transactions
50
- else
51
- ActiveRecord::Base.__send__(:increment_open_transactions)
52
- end
53
- ActiveRecord::Base.connection.begin_db_transaction
54
- ActionMailer::Base.deliveries = [] if defined?(ActionMailer::Base)
55
- end
56
-
57
- $cucumber_toplevel.After do
58
- ActiveRecord::Base.connection.rollback_db_transaction
59
- if ActiveRecord::Base.connection.respond_to?(:decrement_open_transactions)
60
- ActiveRecord::Base.connection.decrement_open_transactions
61
- else
62
- ActiveRecord::Base.__send__(:decrement_open_transactions)
63
- end
64
- end
65
- end
66
- end
67
-
68
- end
69
- end
70
-
71
- World do
72
- Cucumber::Rails::World.new
73
- end
@@ -1,111 +0,0 @@
1
- require 'cucumber/platform'
2
-
3
- module Cucumber
4
- module Rake
5
- # Defines a task for running features.
6
- class Task
7
- LIB = File.expand_path(File.dirname(__FILE__) + '/../..')
8
-
9
- attr_accessor :libs
10
- attr_accessor :binary
11
- attr_accessor :step_list
12
- attr_accessor :step_pattern
13
- attr_accessor :feature_list
14
- attr_accessor :feature_pattern
15
- attr_accessor :cucumber_opts
16
- attr_accessor :rcov
17
- attr_accessor :rcov_opts
18
- attr_accessor :language
19
-
20
- # Define a task
21
- def initialize(task_name = "features", desc = "Run Features with Cucumber")
22
- @task_name, @desc = task_name, desc
23
- @libs = []
24
- @rcov_opts = %w{--rails --exclude osx\/objc,gems\/}
25
-
26
- yield self if block_given?
27
-
28
- if language
29
- @feature_pattern = "features/#{language}/*.feature"
30
- @step_pattern = "features/#{language}/step_definitions/*.rb"
31
- else
32
- @feature_pattern = "features/**/*.feature" if feature_pattern.nil? && feature_list.nil?
33
- @step_pattern = "features/**/*.rb" if step_pattern.nil? && step_list.nil?
34
- end
35
-
36
- @binary = binary.nil? ? Cucumber::BINARY : File.expand_path(binary)
37
- @libs.insert(0, LIB) if binary == Cucumber::BINARY
38
-
39
- define_task
40
- end
41
-
42
- def define_task
43
- desc @desc
44
- task @task_name do
45
- ruby(arguments_for_ruby_execution.join(" ")) # ruby(*args) is broken on Windows
46
- end
47
- end
48
-
49
- def arguments_for_ruby_execution(task_args = nil)
50
- lib_args = ['"%s"' % libs.join(File::PATH_SEPARATOR)]
51
- cucumber_bin = ['"%s"' % binary]
52
- cuc_opts = [(ENV['CUCUMBER_OPTS'] || cucumber_opts)]
53
-
54
- step_files(task_args).each do |step_file|
55
- cuc_opts << '--require'
56
- cuc_opts << step_file
57
- end
58
-
59
- if rcov
60
- args = (['-I'] + lib_args + ['-S', 'rcov'] + rcov_opts +
61
- cucumber_bin + ['--'] + cuc_opts + feature_files(task_args)).flatten
62
- else
63
- args = (['-I'] + lib_args + cucumber_bin + cuc_opts + feature_files(task_args)).flatten
64
- end
65
-
66
- args
67
- end
68
-
69
- def feature_files(task_args = nil) # :nodoc:
70
- if ENV['FEATURE']
71
- FileList[ ENV['FEATURE'] ]
72
- else
73
- result = []
74
- result += feature_list.to_a if feature_list
75
- result += FileList[feature_pattern].to_a if feature_pattern
76
- FileList[result]
77
- end
78
- end
79
-
80
- def step_files(task_args = nil) # :nodoc:
81
- if ENV['STEPS']
82
- FileList[ ENV['STEPS'] ]
83
- else
84
- result = []
85
- result += Array(step_list) if step_list
86
- result += Array(FileList[step_pattern]) if step_pattern
87
- FileList[result]
88
- end
89
- end
90
- end
91
-
92
- class FeatureTask < Task
93
-
94
- def initialize(task_name = "feature", desc = "Run a specified feature with Cucumber. #{task_name}[feature_name]")
95
- super(task_name, desc)
96
- end
97
-
98
- def define_task
99
- desc @desc
100
- task @task_name, :feature_name do |t, args|
101
- ruby(arguments_for_ruby_execution(args).join(" ")) # ruby(*args) is broken on Windows
102
- end
103
- end
104
-
105
- def feature_files(task_arguments) # :nodoc:
106
- FileList[File.join("features", "**", "#{task_arguments[:feature_name]}.feature")]
107
- end
108
-
109
- end
110
- end
111
- end
@@ -1,87 +0,0 @@
1
- require 'cucumber/core_ext/string'
2
- require 'cucumber/core_ext/proc'
3
-
4
- module Cucumber
5
- # A Step Definition holds a Regexp and a Proc, and is created
6
- # by calling <tt>Given</tt>, <tt>When</tt> or <tt>Then</tt>
7
- # in the <tt>step_definitions</tt> ruby files - for example:
8
- #
9
- # Given /I have (\d+) cucumbers in my belly/ do
10
- # # some code here
11
- # end
12
- #
13
- class StepDefinition
14
- def self.snippet_text(step_keyword, step_name)
15
- escaped = Regexp.escape(step_name).gsub('\ ', ' ').gsub('/', '\/')
16
- "#{step_keyword} /^#{escaped}$/ do\n pending\nend"
17
- end
18
-
19
- class MissingProc < StandardError
20
- def message
21
- "Step definitions must always have a proc"
22
- end
23
- end
24
-
25
- attr_reader :regexp
26
-
27
- def initialize(pattern, &proc)
28
- raise MissingProc if proc.nil?
29
- if String === pattern
30
- p = pattern.gsub(/\$\w+/, '(.*)')
31
- pattern = Regexp.new("^#{p}$")
32
- end
33
- @regexp, @proc = pattern, proc
34
- end
35
-
36
- #:stopdoc:
37
-
38
- def match(step_name)
39
- case step_name
40
- when String then @regexp.match(step_name)
41
- when Regexp then @regexp == step_name
42
- end
43
- end
44
-
45
- # Formats the matched arguments of the associated Step. This method
46
- # is usually called from visitors, which render output.
47
- #
48
- # The +format+ either be a String or a Proc.
49
- #
50
- # If it is a String it should be a format string according to
51
- # <tt>Kernel#sprinf</tt>, for example:
52
- #
53
- # '<span class="param">%s</span></tt>'
54
- #
55
- # If it is a Proc, it should take one argument and return the formatted
56
- # argument, for example:
57
- #
58
- # lambda { |param| "[#{param}]" }
59
- #
60
- def format_args(step_name, format)
61
- step_name.gzub(@regexp, format)
62
- end
63
-
64
- def matched_args(step_name)
65
- step_name.match(@regexp).captures
66
- end
67
-
68
- def execute(step_name, world, *args)
69
- args = args.map{|arg| Ast::PyString === arg ? arg.to_s : arg}
70
- begin
71
- world.cucumber_instance_exec(true, @regexp.inspect, *args, &@proc)
72
- rescue Cucumber::ArityMismatchError => e
73
- e.backtrace.unshift(self.to_backtrace_line)
74
- raise e
75
- end
76
- end
77
-
78
- def to_backtrace_line
79
- "#{file_colon_line}:in `#{@regexp.inspect}'"
80
- end
81
-
82
- def file_colon_line
83
- @proc.file_colon_line
84
- end
85
-
86
- end
87
- end
@@ -1,183 +0,0 @@
1
- require 'cucumber/step_definition'
2
- require 'cucumber/core_ext/instance_exec'
3
-
4
- module Cucumber
5
- class Undefined < StandardError
6
- attr_reader :step_name
7
-
8
- def initialize(step_name)
9
- super %{Undefined step: "#{step_name}"}
10
- @step_name = step_name
11
- end
12
- Cucumber::EXCEPTION_STATUS[self] = :undefined
13
- end
14
-
15
- class Pending < StandardError
16
- Cucumber::EXCEPTION_STATUS[self] = :pending
17
- end
18
-
19
- # Raised when a step matches 2 or more StepDefinition
20
- class Ambiguous < StandardError
21
- def initialize(step_name, step_definitions)
22
- message = "Ambiguous match of \"#{step_name}\":\n\n"
23
- message << step_definitions.map{|sd| sd.to_backtrace_line}.join("\n")
24
- message << "\n\n"
25
- super(message)
26
- end
27
- end
28
-
29
- # Raised when 2 or more StepDefinition have the same Regexp
30
- class Redundant < StandardError
31
- def initialize(step_def_1, step_def_2)
32
- message = "Multiple step definitions have the same Regexp:\n\n"
33
- message << step_def_1.to_backtrace_line << "\n"
34
- message << step_def_2.to_backtrace_line << "\n\n"
35
- super(message)
36
- end
37
- end
38
-
39
- # This is the main interface for registering step definitions, which is done
40
- # from <tt>*_steps.rb</tt> files. This module is included right at the top-level
41
- # so #register_step_definition (and more interestingly - its aliases) are
42
- # available from the top-level.
43
- module StepMother
44
- attr_writer :snippet_generator
45
- attr_writer :options
46
-
47
- # Registers a new StepDefinition. This method is aliased
48
- # to <tt>Given</tt>, <tt>When</tt> and <tt>Then</tt>.
49
- #
50
- # See Cucumber#alias_steps for details on how to
51
- # create your own aliases.
52
- #
53
- # The +&proc+ gets executed in the context of a <tt>world</tt>
54
- # object, which is defined by #World. A new <tt>world</tt>
55
- # object is created for each scenario and is shared across
56
- # step definitions within that scenario.
57
- def register_step_definition(regexp, &proc)
58
- step_definition = StepDefinition.new(regexp, &proc)
59
- step_definitions.each do |already|
60
- raise Redundant.new(already, step_definition) if already.match(regexp)
61
- end
62
- step_definitions << step_definition
63
- step_definition
64
- end
65
-
66
- def world(scenario, prior_world = nil, &proc)
67
- world = prior_world || new_world
68
- begin
69
- (@before_procs ||= []).each do |proc|
70
- world.cucumber_instance_exec(false, 'Before', scenario, &proc)
71
- end
72
- yield world
73
- ensure
74
- (@after_procs ||= []).each do |proc|
75
- world.cucumber_instance_exec(false, 'After', scenario, &proc)
76
- end
77
- end
78
- end
79
-
80
- # Registers a Before proc. You can call this method as many times as you
81
- # want (typically from ruby scripts under <tt>support</tt>).
82
- def Before(&proc)
83
- (@before_procs ||= []) << proc
84
- end
85
-
86
- def After(&proc)
87
- (@after_procs ||= []) << proc
88
- end
89
-
90
- # Registers a World proc. You can call this method as many times as you
91
- # want (typically from ruby scripts under <tt>support</tt>).
92
- def World(&proc)
93
- (@world_procs ||= []) << proc
94
- end
95
-
96
- # Creates a new world instance
97
- def new_world #:nodoc:
98
- world = Object.new
99
- (@world_procs ||= []).each do |proc|
100
- world = proc.call(world)
101
- end
102
-
103
- world.extend(WorldMethods)
104
- world.__cucumber_step_mother = self
105
-
106
- world.extend(::Spec::Matchers) if defined?(::Spec::Matchers)
107
- world
108
- end
109
-
110
- # Looks up the StepDefinition that matches +step_name+
111
- def step_definition(step_name) #:nodoc:
112
- found = step_definitions.select do |step_definition|
113
- step_definition.match(step_name)
114
- end
115
- raise Undefined.new(step_name) if found.empty?
116
- found = best_matches(step_name, found) if found.size > 1 && options[:guess]
117
- raise Ambiguous.new(step_name, found) if found.size > 1
118
- found[0]
119
- end
120
-
121
- def best_matches(step_name, step_definitions)
122
- top_group_score = step_definitions.map {|s| s.match(step_name).captures.length }.sort.last
123
- top_groups = step_definitions.select {|s| s.match(step_name).captures.length == top_group_score }
124
- if top_groups.size > 1
125
- shortest_capture_length = top_groups.map {|s| s.match(step_name).captures.inject(0) {|sum, c| sum + c.length } }.sort.first
126
- top_groups.select {|s| s.match(step_name).captures.inject(0) {|sum, c| sum + c.length } == shortest_capture_length }
127
- else
128
- top_groups
129
- end
130
- end
131
-
132
- def step_definitions
133
- @step_definitions ||= []
134
- end
135
-
136
- def snippet_text(step_keyword, step_name)
137
- @snippet_generator.snippet_text(step_keyword, step_name)
138
- end
139
-
140
- private
141
-
142
- def options
143
- @options || {}
144
- end
145
-
146
- module WorldMethods #:nodoc:
147
- attr_writer :__cucumber_step_mother, :__cucumber_current_step
148
-
149
- # Call a step from within a step definition
150
- def __cucumber_invoke(name, *multiline_arguments)
151
- begin
152
- # TODO: Very similar to code in Step. Refactor. Get back StepInvocation?
153
- # Make more similar to JBehave?
154
- step_definition = @__cucumber_step_mother.step_definition(name)
155
- matched_args = step_definition.matched_args(name)
156
- args = (matched_args + multiline_arguments)
157
- step_definition.execute(name, self, *args)
158
- rescue Exception => e
159
- @__cucumber_current_step.exception = e
160
- raise e
161
- end
162
- end
163
-
164
- def table(text, file=nil, line=0)
165
- @table_parser ||= Parser::TableParser.new
166
- @table_parser.parse_or_fail(text.strip, file, line)
167
- end
168
-
169
- def pending(message = "TODO")
170
- if block_given?
171
- begin
172
- yield
173
- rescue Exception => e
174
- raise Pending.new(message)
175
- end
176
- raise Pending.new("Expected pending '#{message}' to fail. No Error was raised. No longer pending?")
177
- else
178
- raise Pending.new(message)
179
- end
180
- end
181
- end
182
- end
183
- end
@@ -1,10 +0,0 @@
1
- module Cucumber #:nodoc:
2
- class VERSION #:nodoc:
3
- MAJOR = 0
4
- MINOR = 1
5
- TINY = 99
6
- PATCH = 21 # Set to nil for official release
7
-
8
- STRING = [MAJOR, MINOR, TINY, PATCH].compact.join('.')
9
- end
10
- end
data/lib/cucumber.rb DELETED
@@ -1,71 +0,0 @@
1
- $:.unshift(File.dirname(__FILE__)) unless
2
- $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
3
-
4
- require 'yaml'
5
- require 'cucumber/platform'
6
- require 'cucumber/parser'
7
- require 'cucumber/version'
8
- require 'cucumber/step_mother'
9
- require 'cucumber/cli/main'
10
- require 'cucumber/broadcaster'
11
- require 'cucumber/core_ext/exception'
12
-
13
- module Cucumber
14
- KEYWORD_KEYS = %w{name native encoding feature background scenario scenario_outline examples given when then but}
15
-
16
- class << self
17
- attr_reader :lang
18
-
19
- def load_language(lang) #:nodoc:
20
- return if @lang
21
- @lang = lang
22
- alias_step_definitions(lang)
23
- Parser.load_parser(keyword_hash)
24
- end
25
-
26
- def language_incomplete?(lang=@lang)
27
- KEYWORD_KEYS.detect{|key| keyword_hash(lang)[key].nil?}
28
- end
29
-
30
- # File mode that accounts for Ruby platform and current language
31
- def file_mode(m)
32
- Cucumber::RUBY_1_9 ? "#{m}:#{keyword_hash['encoding']}" : m
33
- end
34
-
35
- # Returns a Hash of the currently active
36
- # language, or for a specific language if +lang+ is
37
- # specified.
38
- def keyword_hash(lang=@lang)
39
- LANGUAGES[lang]
40
- end
41
-
42
- def alias_step_definitions(lang) #:nodoc:
43
- keywords = %w{given when then and but}.map{|keyword| keyword_hash(lang)[keyword]}
44
- alias_steps(keywords)
45
- end
46
-
47
- # Sets up additional aliases for Given, When and Then.
48
- # Try adding the following to your <tt>support/env.rb</tt>:
49
- #
50
- # # Given When Then in Norwegian
51
- # Cucumber.alias_steps %w{Gitt Naar Saa}
52
- #
53
- # You cannot use special characters here, because methods
54
- # with special characters is not valid Ruby code
55
- #
56
- def alias_steps(keywords)
57
- keywords.each do |adverb|
58
- StepMother.class_eval do
59
- alias_method adverb, :register_step_definition
60
- end
61
-
62
- StepMother::WorldMethods.class_eval do
63
- alias_method adverb, :__cucumber_invoke
64
- end
65
- end
66
- end
67
- end
68
-
69
- # Make sure we always have English aliases
70
- alias_step_definitions('en')
71
- end
@@ -1,14 +0,0 @@
1
- Description:
2
- Sets up Cucumber in your Rails project. After running this generator you will
3
- get a new rake task called features.
4
-
5
- This also generates the necessary files in the features directory.
6
-
7
- Also see the feature generator, which you can use to generate skeletons
8
- for new features.
9
-
10
- If you set the language option, then a subdirectory features/[language] will be generated instead.
11
- Now your are able to use features in different languages.
12
-
13
- Examples:
14
- `./script/generate cucumber`