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,82 +0,0 @@
1
- require File.dirname(__FILE__) + '/../../spec_helper'
2
- require 'cucumber/step_mother'
3
- require 'cucumber/ast'
4
-
5
- module Cucumber
6
- module Ast
7
- describe Scenario do
8
- before do
9
- @step_mother = Object.new
10
- @step_mother.extend(StepMother)
11
- $x = $y = nil
12
- @step_mother.Before do
13
- $x = 3
14
- end
15
- @step_mother.Given /y is (\d+)/ do |n|
16
- $y = n.to_i
17
- end
18
- @visitor = Visitor.new(@step_mother)
19
- @visitor.options = {}
20
- end
21
-
22
- it "should execute Before blocks before steps" do
23
- scenario = Scenario.new(
24
- comment=Comment.new(""),
25
- tags=Tags.new(98,[]),
26
- line=99,
27
- keyword="",
28
- name="",
29
- steps=[
30
- Step.new(7, "Given", "y is 5")
31
- ])
32
- @visitor.visit_feature_element(scenario)
33
- $x.should == 3
34
- $y.should == 5
35
- end
36
-
37
- it "should skip steps when previous is not passed" do
38
- scenario = Scenario.new(
39
- comment=Comment.new(""),
40
- tags=Tags.new(98, []),
41
- line=99,
42
- keyword="",
43
- name="",
44
- steps=[
45
- Step.new(7, "Given", "this is missing"),
46
- Step.new(8, "Given", "y is 5")
47
- ])
48
- @visitor.visit_feature_element(scenario)
49
-
50
- $x.should == 3
51
- $y.should == nil
52
- end
53
-
54
- it "should be at exact line" do
55
- s = Scenario.new(comment=Comment.new(""),
56
- tags=Tags.new(44, []), 45, keyword="", name="", steps=[])
57
-
58
- s.should be_at_lines([44])
59
- s.should be_at_lines([45])
60
- end
61
-
62
- it "should be at line if tags or steps are" do
63
- s = Scenario.new(
64
- comment=Comment.new(""),
65
- tags=Tags.new(43, []),
66
- line=45,
67
- keyword="",
68
- name="",
69
- steps=[
70
- Step.new(46, "Given", ""),
71
- Step.new(47, "Given", ""),
72
- Step.new(48, "Given", ""),
73
- ]
74
- )
75
-
76
- s.should be_at_lines([43])
77
- s.should be_at_lines([47])
78
- s.should_not be_at_lines([49])
79
- end
80
- end
81
- end
82
- end
@@ -1,45 +0,0 @@
1
- require File.dirname(__FILE__) + '/../../spec_helper'
2
- require 'cucumber/step_mother'
3
- require 'cucumber/ast'
4
- require 'cucumber/core_ext/string'
5
-
6
- module Cucumber
7
- module Ast
8
- describe StepMother do
9
- it "should calculate comment padding" do
10
- scenario = Scenario.new(comment=nil, tags=nil, line=nil, keyword='Given', name='Gazpacho', steps=[
11
- Step.new(22, "Given", "tøtal 13"),
12
- Step.new(23, "And", "the total 15")
13
- ])
14
- step1, step2 = *scenario.instance_variable_get('@steps')
15
-
16
- step1.source_indent.should == 2
17
- step2.source_indent.should == 0
18
- end
19
- end
20
-
21
- describe Step do
22
- describe "execute step with arguments" do
23
-
24
- it "should replace arguments in multiline args" do
25
- mock_multiline_arg = mock('multiline arg')
26
- step = Step.new(23, 'Given', '<test>', mock_multiline_arg)
27
-
28
- mock_multiline_arg.should_receive(:arguments_replaced).with({'<test>' => '10'}).and_return(mock_multiline_arg)
29
-
30
- step.execute_with_arguments({'test' => '10'}, stub('world'), :passed, visitor=nil, line=-1)
31
- end
32
-
33
- it "should invoke step with replaced multiline args" do
34
- mock_step_definition = mock('step definition')
35
- mock_multiline_arg_replaced = mock('multiline arg replaced')
36
- mock_multiline_arg = mock('multiline arg', :arguments_replaced => mock_multiline_arg_replaced)
37
- step = Step.new(45, 'Given', '<test>', mock_multiline_arg)
38
-
39
- step.execute_with_arguments({'test' => '10'}, stub('world'), :passed, visitor=nil, line=-1)
40
- end
41
-
42
- end
43
- end
44
- end
45
- end
@@ -1,81 +0,0 @@
1
- require File.dirname(__FILE__) + '/../../spec_helper'
2
- require 'cucumber/ast/table'
3
-
4
- module Cucumber
5
- module Ast
6
- describe Table do
7
- before do
8
- @table = Table.new([
9
- %w{1 22 333},
10
- %w{4444 55555 666666}
11
- ])
12
- @table.extend(Module.new{
13
- attr_reader :raw
14
- })
15
- def @table.cells_rows; super; end
16
- def @table.columns; super; end
17
- end
18
-
19
- it "should have rows" do
20
- @table.cells_rows[0].map{|cell| cell.value}.should == %w{1 22 333}
21
- end
22
-
23
- it "should have columns" do
24
- @table.columns[1].map{|cell| cell.value}.should == %w{22 55555}
25
- end
26
-
27
- it "should have same cell objects in rows and columns" do
28
- # 666666
29
- @table.cells_rows[1].__send__(:[], 2).should equal(@table.columns[2].__send__(:[], 1))
30
- end
31
-
32
- it "should know about max width of a row" do
33
- @table.columns[1].__send__(:width).should == 5
34
- end
35
-
36
- it "should be convertible to an array of hashes" do
37
- @table.hashes.should == [
38
- {'1' => '4444', '22' => '55555', '333' => '666666'}
39
- ]
40
- end
41
-
42
- describe "replacing arguments" do
43
-
44
- before(:each) do
45
- @table = table = Table.new([
46
- %w{qty book},
47
- %w{<qty> <book>}
48
- ])
49
- end
50
-
51
- it "should return a new table with arguments replaced with values" do
52
- table_with_replaced_args = @table.arguments_replaced({'<book>' => 'Unbearable lightness of being', '<qty>' => '5'})
53
-
54
- table_with_replaced_args.hashes[0]['book'].should == 'Unbearable lightness of being'
55
- table_with_replaced_args.hashes[0]['qty'].should == '5'
56
- end
57
-
58
- it "should not change the original table" do
59
- table_with_replaced_args = @table.arguments_replaced({'<book>' => 'Unbearable lightness of being'})
60
-
61
- @table.hashes[0]['book'].should_not == 'Unbearable lightness of being'
62
- end
63
-
64
- end
65
-
66
- it "should convert to sexp" do
67
- @table.to_sexp.should ==
68
- [:table,
69
- [:row,
70
- [:cell, "1"],
71
- [:cell, "22"],
72
- [:cell, "333"]
73
- ],
74
- [:row,
75
- [:cell, "4444"],
76
- [:cell, "55555"],
77
- [:cell, "666666"]]]
78
- end
79
- end
80
- end
81
- end
@@ -1,23 +0,0 @@
1
- require File.dirname(__FILE__) + '/../../spec_helper'
2
-
3
- module Cucumber
4
- module Ast
5
- describe Tags do
6
- before do
7
- @tags = Tags.new(-1, %w{one two three})
8
- end
9
-
10
- it "should be among other tags" do
11
- @tags.should be_among(%w{one})
12
- end
13
-
14
- it "should be among other tags even with @ prefix" do
15
- @tags.should be_among(%w{@one})
16
- end
17
-
18
- it "should not be among other tags" do
19
- @tags.should_not be_among(%w{one !two})
20
- end
21
- end
22
- end
23
- end
@@ -1,14 +0,0 @@
1
- require File.dirname(__FILE__) + '/../spec_helper'
2
-
3
- module Cucumber
4
- describe Broadcaster do
5
-
6
- it "should broadcast methods to registered objects" do
7
- receiver = mock('receiver')
8
- broadcaster = Broadcaster.new([receiver])
9
-
10
- receiver.should_receive(:konbanwa).with('good evening')
11
- broadcaster.konbanwa('good evening')
12
- end
13
- end
14
- end
@@ -1,239 +0,0 @@
1
- require File.dirname(__FILE__) + '/../../spec_helper'
2
- require 'yaml'
3
-
4
- module Cucumber
5
- module Cli
6
- describe Configuration do
7
-
8
- def given_cucumber_yml_defined_as(hash_or_string)
9
- File.stub!(:exist?).and_return(true)
10
- cucumber_yml = hash_or_string.is_a?(Hash) ? hash_or_string.to_yaml : hash_or_string
11
- IO.stub!(:read).with('cucumber.yml').and_return(cucumber_yml)
12
- end
13
-
14
- before(:each) do
15
- Kernel.stub!(:exit).and_return(nil)
16
- end
17
-
18
- it "should require files in support paths first" do
19
- File.stub!(:directory?).and_return(true)
20
- Dir.stub!(:[]).and_return(["/features/step_definitions/foo.rb","/features/support/env.rb"])
21
-
22
- config = Configuration.new(StringIO.new)
23
- config.parse!(%w{--require /features})
24
-
25
- config.files_to_require.should == [
26
- "/features/support/env.rb",
27
- "/features/step_definitions/foo.rb"
28
- ]
29
- end
30
-
31
- it "should expand args from YAML file" do
32
- given_cucumber_yml_defined_as({'bongo' => '--require from/yml'})
33
-
34
- config = Configuration.new
35
- config.parse!(%w{--format progress --profile bongo})
36
- config.options[:formats].should == {'progress' => STDOUT}
37
- config.options[:require].should == ['from/yml']
38
- end
39
-
40
- it "should expand args from YAML file's default if there are no args" do
41
- given_cucumber_yml_defined_as({'default' => '--require from/yml'})
42
-
43
- config = Configuration.new
44
- config.parse!([])
45
- config.options[:require].should == ['from/yml']
46
- end
47
-
48
- it "should provide a helpful error message when a specified profile does not exists in YAML file" do
49
- given_cucumber_yml_defined_as({'default' => '--require from/yml', 'html_report' => '--format html'})
50
-
51
- config = Configuration.new(StringIO.new, error = StringIO.new)
52
- config.parse!(%w{--profile i_do_not_exist})
53
-
54
- expected_message = <<-END_OF_MESSAGE
55
- Could not find profile: 'i_do_not_exist'
56
-
57
- Defined profiles in cucumber.yml:
58
- * default
59
- * html_report
60
- END_OF_MESSAGE
61
-
62
- error.string.should == expected_message
63
- end
64
-
65
- it "should provide a helpful error message when a specified profile is not a String" do
66
- given_cucumber_yml_defined_as({'foo' => [1,2,3]})
67
-
68
- config = Configuration.new(StringIO.new, error = StringIO.new)
69
- config.parse!(%w{--profile foo})
70
-
71
- error.string.should == "Profiles must be defined as a String. The 'foo' profile was [1, 2, 3] (Array).\n"
72
- end
73
-
74
- it "should provide a helpful error message when a specified profile exists but is nil or blank" do
75
- [nil, ' '].each do |bad_input|
76
- given_cucumber_yml_defined_as({'foo' => bad_input})
77
-
78
- config = Configuration.new(StringIO.new, error = StringIO.new)
79
- config.parse!(%w{--profile foo})
80
-
81
- error.string.should match(/The 'foo' profile in cucumber.yml was blank. Please define the command line arguments for the 'foo' profile in cucumber.yml./)
82
- end
83
- end
84
-
85
- it "should provide a helpful error message when no YAML file exists and a profile is specified" do
86
- File.should_receive(:exist?).with('cucumber.yml').and_return(false)
87
-
88
- config = Configuration.new(StringIO.new, error = StringIO.new)
89
- config.parse!(%w{--profile i_do_not_exist})
90
-
91
- error.string.should match(/cucumber.yml was not found. Please refer to cucumber's documentaion on defining profiles in cucumber.yml./)
92
- end
93
-
94
- it "should provide a helpful error message when cucumber.yml is blank or malformed" do
95
- expected_error_message = /cucumber.yml was found, but was blank or malformed. Please refer to cucumber's documentaion on correct profile usage./
96
-
97
- ['', 'sfsadfs', "--- \n- an\n- array\n", "---dddfd"].each do |bad_input|
98
- given_cucumber_yml_defined_as(bad_input)
99
-
100
- config = Configuration.new(StringIO.new, error = StringIO.new)
101
- config.parse!([])
102
-
103
- error.string.should match(expected_error_message)
104
- end
105
- end
106
-
107
- it "should procide a helpful error message when the YAML can not be parsed" do
108
- expected_error_message = /cucumber.yml was found, but could not be parsed. Please refer to cucumber's documentaion on correct profile usage./
109
-
110
- given_cucumber_yml_defined_as("input that causes an exception in YAML loading")
111
- YAML.should_receive(:load).and_raise Exception
112
-
113
- config = Configuration.new(StringIO.new, error = StringIO.new)
114
- config.parse!([])
115
-
116
- error.string.should match(expected_error_message)
117
- end
118
-
119
- it "should accept --dry-run option" do
120
- config = Configuration.new(StringIO.new)
121
- config.parse!(%w{--dry-run})
122
- config.options[:dry_run].should be_true
123
- end
124
-
125
- it "should accept --no-source option" do
126
- config = Configuration.new
127
- config.parse!(%w{--no-source})
128
-
129
- config.options[:source].should be_false
130
- end
131
-
132
- it "should accept --no-snippets option" do
133
- config = Configuration.new
134
- config.parse!(%w{--no-snippets})
135
-
136
- config.options[:snippets].should be_false
137
- end
138
-
139
- it "should set snippets and source to false with --quiet option" do
140
- config = Configuration.new
141
- config.parse!(%w{--quiet})
142
-
143
- config.options[:snippets].should be_nil
144
- config.options[:source].should be_nil
145
- end
146
-
147
- it "should accept --verbose option" do
148
- config = Configuration.new
149
- config.parse!(%w{--verbose})
150
-
151
- config.options[:verbose].should be_true
152
- end
153
-
154
- it "should accept --out option" do
155
- config = Configuration.new(StringIO.new)
156
- config.parse!(%w{--out jalla.txt})
157
- config.options[:formats]['pretty'].should == 'jalla.txt'
158
- end
159
-
160
- it "should accept multiple --out options" do
161
- config = Configuration.new(StringIO.new)
162
- config.parse!(%w{--format progress --out file1 --out file2})
163
- config.options[:formats].should == {'progress' => 'file2'}
164
- end
165
-
166
- it "should accept multiple --format options" do
167
- config = Configuration.new(StringIO.new)
168
- config.parse!(%w{--format pretty --format progress})
169
- config.options[:formats].should have_key('pretty')
170
- config.options[:formats].should have_key('progress')
171
- end
172
-
173
- it "should associate --out to previous --format" do
174
- config = Configuration.new(StringIO.new)
175
- config.parse!(%w{--format progress --out file1 --format profile --out file2})
176
- config.options[:formats].should == {"profile"=>"file2", "progress"=>"file1"}
177
- end
178
-
179
- it "should accept --color option" do
180
- Term::ANSIColor.should_receive(:coloring=).with(true)
181
- config = Configuration.new(StringIO.new)
182
- config.parse!(['--color'])
183
- end
184
-
185
- it "should accept --no-color option" do
186
- Term::ANSIColor.should_receive(:coloring=).with(false)
187
- config = Configuration.new(StringIO.new)
188
- config.parse!(['--no-color'])
189
- end
190
-
191
- describe "--backtrace" do
192
- before do
193
- Exception.cucumber_full_backtrace = false
194
- end
195
-
196
- it "should show full backtrace when --backtrace is present" do
197
- config = Main.new(['--backtrace'])
198
- begin
199
- "x".should == "y"
200
- rescue => e
201
- e.backtrace[0].should_not == "#{__FILE__}:#{__LINE__ - 2}"
202
- end
203
- end
204
-
205
- xit "should strip gems when --backtrace is absent" do
206
- config = Main.new(['--'])
207
- begin
208
- "x".should == "y"
209
- rescue => e
210
- e.backtrace[0].should == "#{__FILE__}:#{__LINE__ - 2}"
211
- end
212
- end
213
-
214
- after do
215
- Exception.cucumber_full_backtrace = false
216
- end
217
- end
218
-
219
- it "should accept multiple --scenario options" do
220
- config = Configuration.new
221
- config.parse!(['--scenario', "User logs in", '--scenario', "User signs up"])
222
-
223
- config.options[:scenario_names].should include("User logs in")
224
- config.options[:scenario_names].should include("User signs up")
225
- end
226
-
227
- it "should search for all features in the specified directory" do
228
- File.stub!(:directory?).and_return(true)
229
- Dir.should_receive(:[]).with("feature_directory/**/*.feature").any_number_of_times.and_return(["cucumber.feature"])
230
-
231
- config = Configuration.new(StringIO)
232
- config.parse!(%w{feature_directory/})
233
-
234
- config.feature_files.should == ["cucumber.feature"]
235
- end
236
-
237
- end
238
- end
239
- end
@@ -1,164 +0,0 @@
1
- require File.dirname(__FILE__) + '/../../spec_helper'
2
- require 'yaml'
3
-
4
- module Cucumber
5
- module Cli
6
- describe Main do
7
-
8
- before(:each) do
9
- Kernel.stub!(:exit).and_return(nil)
10
- end
11
-
12
- describe "verbose mode" do
13
-
14
- before(:each) do
15
- @out = StringIO.new
16
- @empty_feature = Ast::Feature.new(Ast::Comment.new(''), Ast::Tags.new(2, []), "Feature", [])
17
- Dir.stub!(:[])
18
- end
19
-
20
- it "should show ruby files required" do
21
- @cli = Main.new(%w{--verbose --require example.rb}, @out)
22
- @cli.stub!(:require)
23
-
24
- @cli.execute!(Object.new.extend(StepMother))
25
-
26
- @out.string.should include('example.rb')
27
- end
28
-
29
- it "should show feature files parsed" do
30
- @cli = Main.new(%w{--verbose example.feature}, @out)
31
- @cli.stub!(:require)
32
-
33
- Parser::FeatureParser.stub!(:new).and_return(mock("feature parser", :parse_file => @empty_feature))
34
-
35
- @cli.execute!(Object.new.extend(StepMother))
36
-
37
- @out.string.should include('example.feature')
38
- end
39
-
40
- end
41
-
42
- describe "--format with class" do
43
-
44
- describe "in module" do
45
-
46
- it "should resolve each module until it gets Formatter class" do
47
- cli = Main.new(%w{--format ZooModule::MonkeyFormatterClass}, nil)
48
- mock_module = mock('module')
49
- Object.stub!(:const_defined?).and_return(true)
50
- mock_module.stub!(:const_defined?).and_return(true)
51
-
52
- f = stub('formatter', :null_object => true)
53
-
54
- Object.should_receive(:const_get).with('ZooModule').and_return(mock_module)
55
- mock_module.should_receive(:const_get).with('MonkeyFormatterClass').and_return(mock('formatter class', :new => f))
56
-
57
- cli.execute!(Object.new.extend(StepMother))
58
- end
59
-
60
- end
61
-
62
- describe "exists and valid constructor" do
63
-
64
- before(:each) do
65
- @mock_formatter_class = mock('formatter class')
66
- Object.stub!(:const_get).and_return(@mock_formatter_class)
67
- Object.stub!(:const_defined?).with('magical').and_return(true)
68
- end
69
-
70
- xit "should create the formatter" do
71
- cli = Main.new
72
- mock_formatter = mock('magical formatter')
73
- cli.parse_options!(%w{--format magical})
74
-
75
- @mock_formatter_class.should_receive(:new)
76
-
77
- cli.execute!(stub('step mother'), mock_executor, stub('features'))
78
- end
79
-
80
- xit "should register the formatter with broadcaster" do
81
- cli = Main.new
82
- broadcaster = Broadcaster.new
83
- mock_formatter = mock('magical formatter')
84
- Broadcaster.stub!(:new).and_return(broadcaster, stub("output broadcaster", :register => nil))
85
- @mock_formatter_class.stub!(:new).and_return(mock_formatter)
86
- cli.parse_options!(%w{--format magical})
87
-
88
- broadcaster.should_receive(:register).with(mock_formatter)
89
-
90
- cli.execute!(stub('step mother'), mock_executor, stub('features'))
91
- end
92
-
93
- end
94
-
95
- describe "exists but invalid constructor" do
96
-
97
- before(:each) do
98
- @out = StringIO.new
99
- @error = StringIO.new
100
- @cli = Main.new(@out, @error)
101
-
102
- mock_formatter_class = stub('formatter class')
103
- mock_formatter_class.stub!(:new).and_raise("No such method")
104
- Object.stub!(:const_get).and_return(mock_formatter_class)
105
- Object.stub!(:const_defined?).with('exists_but_evil').and_return(true)
106
-
107
- @cli.parse_options!(%w{--format exists_but_evil})
108
- end
109
-
110
- xit "should show exception" do
111
- Kernel.stub!(:exit)
112
-
113
- @cli.execute!(stub('step mother'))
114
-
115
- @error.string.should include("No such method")
116
- end
117
-
118
- xit "should exit" do
119
- Kernel.should_receive(:exit)
120
-
121
- @cli.execute!(stub('step mother'), mock_executor, stub('features'))
122
- end
123
-
124
- end
125
-
126
- describe "non-existent" do
127
-
128
- before(:each) do
129
- @out = StringIO.new
130
- @error = StringIO.new
131
- @cli = Main.new(@out, @error)
132
-
133
- @cli.parse_options!(%w{--format invalid})
134
- end
135
-
136
- xit "should display a format error" do
137
- Kernel.stub!(:exit)
138
-
139
- @cli.execute!(stub('step mother'), mock_executor, stub('features'))
140
-
141
- @error.string.should include("Invalid format: invalid\n")
142
- end
143
-
144
- xit "should display --help" do
145
- Kernel.stub!(:exit)
146
-
147
- @cli.execute!(stub('step mother'))
148
-
149
- @out.string.should include("Usage: cucumber")
150
- end
151
-
152
- xit "should exit" do
153
- Kernel.should_receive(:exit)
154
-
155
- @cli.execute!(stub('step mother'), mock_executor, stub('features'))
156
- end
157
-
158
- end
159
-
160
- end
161
-
162
- end
163
- end
164
- end
@@ -1,37 +0,0 @@
1
- require File.dirname(__FILE__) + '/../../spec_helper'
2
- require 'cucumber/core_ext/instance_exec'
3
-
4
- describe Proc do
5
- it "should raise ArityMismatchError for too many args (expecting 0)" do
6
- lambda {
7
- Object.new.cucumber_instance_exec(true, 'foo', 1) do
8
- end
9
- }.should raise_error(Cucumber::ArityMismatchError, "expected 0 block argument(s), got 1")
10
- end
11
-
12
- it "should raise ArityMismatchError for too many args (expecting 1)" do
13
- lambda {
14
- Object.new.cucumber_instance_exec(true, 'foo', 1,2) do |a|
15
- end
16
- }.should raise_error(Cucumber::ArityMismatchError, "expected 1 block argument(s), got 2")
17
- end
18
-
19
- it "should raise ArityMismatchError for too few args (expecting 1)" do
20
- lambda {
21
- Object.new.cucumber_instance_exec(true, 'foo') do |a|
22
- end
23
- }.should raise_error(Cucumber::ArityMismatchError, "expected 1 block argument(s), got 0")
24
- end
25
-
26
- it "should raise ArityMismatchError for too few args (expecting 2)" do
27
- lambda {
28
- Object.new.cucumber_instance_exec(true, 'foo', 1) do |a,b|
29
- end
30
- }.should raise_error(Cucumber::ArityMismatchError, "expected 2 block argument(s), got 1")
31
- end
32
-
33
- it "should remove extraneous path info for file" do
34
- proc = lambda {|a,b|}
35
- proc.file_colon_line.should == "spec/cucumber/core_ext/proc_spec.rb:34"
36
- end
37
- end