cucumber 0.2.3 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (128) hide show
  1. data/History.txt +56 -1
  2. data/Manifest.txt +70 -49
  3. data/config/hoe.rb +1 -1
  4. data/cucumber.yml +1 -1
  5. data/examples/i18n/bg/Rakefile +6 -0
  6. data/examples/i18n/bg/features/addition.feature +11 -0
  7. data/examples/i18n/bg/features/consecutive_calculations.feature +18 -0
  8. data/examples/i18n/bg/features/division.feature +16 -0
  9. data/examples/i18n/bg/features/step_definitons/calculator_steps.rb +24 -0
  10. data/examples/i18n/bg/features/support/env.rb +6 -0
  11. data/examples/i18n/bg/features/support/world.rb +8 -0
  12. data/examples/i18n/bg/lib/calculator.rb +24 -0
  13. data/examples/i18n/ru/features/support/world.rb +4 -3
  14. data/examples/i18n/sk/Rakefile +6 -0
  15. data/examples/i18n/sk/features/addition.feature +16 -0
  16. data/examples/i18n/sk/features/division.feature +9 -0
  17. data/examples/i18n/sk/features/step_definitons/calculator_steps.rb +24 -0
  18. data/examples/i18n/sk/lib/calculator.rb +14 -0
  19. data/examples/self_test/features/background/background_with_name.feature +7 -0
  20. data/examples/self_test/features/background/passing_background.feature +2 -2
  21. data/examples/self_test/features/step_definitions/sample_steps.rb +18 -2
  22. data/examples/self_test/features/undefined_multiline_args.feature +12 -0
  23. data/examples/sinatra/features/support/env.rb +2 -6
  24. data/examples/test_unit/features/step_definitions/test_unit_steps.rb +1 -4
  25. data/examples/tickets/Rakefile +1 -1
  26. data/examples/tickets/features/229/tagged_hooks.feature +8 -0
  27. data/examples/tickets/features/229/tagged_hooks.rb +14 -0
  28. data/examples/tickets/features/270/back.feature +14 -0
  29. data/examples/tickets/features/270/back.steps.rb +14 -0
  30. data/examples/tickets/features/279/py_string_indent.feature +25 -0
  31. data/examples/tickets/features/279/py_string_indent.steps.rb +12 -0
  32. data/examples/tickets/features/279/wrong.feature_ +11 -0
  33. data/examples/tickets/features/step_definitons/tickets_steps.rb +0 -7
  34. data/features/background.feature +21 -3
  35. data/features/cucumber_cli.feature +18 -5
  36. data/features/cucumber_cli_outlines.feature +4 -1
  37. data/features/rake_task.feature +132 -0
  38. data/features/snippet.feature +23 -0
  39. data/features/step_definitions/cucumber_steps.rb +46 -15
  40. data/features/support/env.rb +61 -4
  41. data/features/usage.feature +5 -0
  42. data/gem_tasks/deployment.rake +1 -1
  43. data/lib/cucumber/ast/background.rb +14 -4
  44. data/lib/cucumber/ast/examples.rb +0 -12
  45. data/lib/cucumber/ast/feature.rb +2 -12
  46. data/lib/cucumber/ast/feature_element.rb +4 -8
  47. data/lib/cucumber/ast/features.rb +1 -1
  48. data/lib/cucumber/ast/outline_table.rb +20 -20
  49. data/lib/cucumber/ast/py_string.rb +6 -11
  50. data/lib/cucumber/ast/scenario.rb +1 -8
  51. data/lib/cucumber/ast/scenario_outline.rb +1 -11
  52. data/lib/cucumber/ast/step.rb +3 -9
  53. data/lib/cucumber/ast/step_collection.rb +0 -4
  54. data/lib/cucumber/ast/step_invocation.rb +5 -6
  55. data/lib/cucumber/ast/table.rb +5 -22
  56. data/lib/cucumber/ast/tags.rb +9 -9
  57. data/lib/cucumber/ast/visitor.rb +12 -25
  58. data/lib/cucumber/cli/configuration.rb +4 -4
  59. data/lib/cucumber/cli/main.rb +10 -3
  60. data/lib/cucumber/core_ext/instance_exec.rb +17 -4
  61. data/lib/cucumber/formatter/ansicolor.rb +1 -1
  62. data/lib/cucumber/formatter/console.rb +2 -1
  63. data/lib/cucumber/formatter/html.rb +21 -7
  64. data/lib/cucumber/formatter/pretty.rb +27 -20
  65. data/lib/cucumber/formatter/usage.rb +16 -0
  66. data/lib/cucumber/languages.yml +23 -5
  67. data/lib/cucumber/parser/feature.rb +231 -114
  68. data/lib/cucumber/parser/feature.tt +120 -25
  69. data/lib/cucumber/parser/table.rb +37 -25
  70. data/lib/cucumber/parser/table.tt +15 -3
  71. data/lib/cucumber/parser/treetop_ext.rb +48 -9
  72. data/lib/cucumber/rake/task.rb +29 -6
  73. data/lib/cucumber/step_definition.rb +4 -2
  74. data/lib/cucumber/step_mother.rb +143 -26
  75. data/lib/cucumber/version.rb +2 -2
  76. data/rails_generators/cucumber/templates/paths.rb +13 -4
  77. data/rails_generators/cucumber/templates/webrat_steps.rb +16 -0
  78. data/{specs → spec}/cucumber/ast/background_spec.rb +1 -0
  79. data/{specs → spec}/cucumber/ast/feature_factory.rb +1 -1
  80. data/{specs → spec}/cucumber/ast/feature_spec.rb +2 -2
  81. data/{specs → spec}/cucumber/ast/py_string_spec.rb +0 -0
  82. data/{specs → spec}/cucumber/ast/scenario_outline_spec.rb +0 -0
  83. data/{specs → spec}/cucumber/ast/scenario_spec.rb +0 -27
  84. data/{specs → spec}/cucumber/ast/step_collection_spec.rb +0 -0
  85. data/{specs → spec}/cucumber/ast/step_spec.rb +0 -0
  86. data/{specs → spec}/cucumber/ast/table_spec.rb +2 -2
  87. data/{specs → spec}/cucumber/broadcaster_spec.rb +0 -0
  88. data/{specs → spec}/cucumber/cli/configuration_spec.rb +0 -0
  89. data/{specs → spec}/cucumber/cli/main_spec.rb +5 -1
  90. data/spec/cucumber/core_ext/proc_spec.rb +54 -0
  91. data/{specs → spec}/cucumber/core_ext/string_spec.rb +0 -0
  92. data/{specs → spec}/cucumber/formatter/ansicolor_spec.rb +0 -0
  93. data/{specs → spec}/cucumber/formatter/color_io_spec.rb +0 -0
  94. data/{specs → spec}/cucumber/formatter/html/cucumber.css +0 -0
  95. data/{specs → spec}/cucumber/formatter/html/cucumber.js +0 -0
  96. data/{specs → spec}/cucumber/formatter/html/index.html +0 -0
  97. data/{specs → spec}/cucumber/formatter/html/jquery-1.3.min.js +0 -0
  98. data/{specs → spec}/cucumber/formatter/html/jquery.uitableedit.js +0 -0
  99. data/{specs → spec}/cucumber/formatters/profile_formatter_spec.rb +0 -0
  100. data/{specs → spec}/cucumber/parser/feature_parser_spec.rb +43 -41
  101. data/{specs → spec}/cucumber/parser/table_parser_spec.rb +0 -0
  102. data/{specs → spec}/cucumber/rails/stubs/mini_rails.rb +0 -0
  103. data/{specs → spec}/cucumber/rails/stubs/test_help.rb +0 -0
  104. data/{specs → spec}/cucumber/rails/world_spec.rb +0 -0
  105. data/{specs → spec}/cucumber/sell_cucumbers.feature +0 -0
  106. data/{specs → spec}/cucumber/step_definition_spec.rb +0 -0
  107. data/{specs → spec}/cucumber/step_mother_spec.rb +63 -4
  108. data/{specs → spec}/cucumber/treetop_parser/empty_feature.feature +0 -0
  109. data/{specs → spec}/cucumber/treetop_parser/empty_scenario.feature +0 -0
  110. data/{specs → spec}/cucumber/treetop_parser/empty_scenario_outline.feature +0 -0
  111. data/{specs → spec}/cucumber/treetop_parser/fit_scenario.feature +0 -0
  112. data/{specs → spec}/cucumber/treetop_parser/given_scenario.feature +0 -0
  113. data/{specs → spec}/cucumber/treetop_parser/invalid_scenario_outlines.feature +0 -0
  114. data/{specs → spec}/cucumber/treetop_parser/multiline_steps.feature +0 -0
  115. data/{specs → spec}/cucumber/treetop_parser/multiple_tables.feature +0 -0
  116. data/{specs → spec}/cucumber/treetop_parser/scenario_outline.feature +0 -0
  117. data/{specs → spec}/cucumber/treetop_parser/spaces.feature +0 -0
  118. data/{specs → spec}/cucumber/treetop_parser/test_dos.feature +0 -0
  119. data/{specs → spec}/cucumber/treetop_parser/with_comments.feature +0 -0
  120. data/{specs → spec}/cucumber/treetop_parser/with_tags.feature +0 -0
  121. data/{specs → spec}/cucumber/world/pending_spec.rb +0 -0
  122. data/{specs → spec}/spec.opts +0 -0
  123. data/{specs → spec}/spec_helper.rb +2 -11
  124. metadata +72 -51
  125. data/examples/tickets/cucumber.yml +0 -3
  126. data/lib/cucumber/parser/basic.rb +0 -0
  127. data/specs/cucumber/ast/tags_spec.rb +0 -19
  128. data/specs/cucumber/core_ext/proc_spec.rb +0 -37
@@ -1,3 +1,58 @@
1
+ == 0.3.0 (In Git)
2
+
3
+ This release has some minor changes to the APIs, but big enough that a new major release is in order.
4
+ The biggest change is the new semantics of the #World method. Previously you would call this method
5
+ several times, passing a Proc and extending the world object of the previous one with a Ruby module.
6
+ The problem was that there was no nice way to ensure the order in which these procs were called, which
7
+ led to some unexpected situations. In this release you can only register a single World proc. If you
8
+ want to extend a world with certain modules, you simply call the #World method with the module(s)
9
+ you wish to extend the World with. The Sinatra example illustrates how to do this. Also check out
10
+ the RDoc for Cucumber::StepMother#World.
11
+
12
+ The Visitor API (which is used for formatters) has also changed slightly. However, we have tried to
13
+ do this in a backwards compatible way, so if you have custom formatters for Cucumber 0.2 they should
14
+ still work.
15
+
16
+ One of the most significant new features is Tagged Hooks: http://wiki.github.com/aslakhellesoy/cucumber/hooks
17
+ This lets you associate Before and After blocks with specific scenarios.
18
+
19
+ We are also deprecating the step_list, step_pattern, feature_list, and feature_pattern accessors on
20
+ Cucumber::Rake::Task. These accessors will be completely removed in version 0.4. For complex settings
21
+ please rely on cucumber profiles in your rake tasks:
22
+ http://wiki.github.com/aslakhellesoy/cucumber/using-rake#profiles
23
+
24
+ === New features
25
+ * Use Hooks with @tags (#229 Aslak Hellesøy)
26
+ * Rake task supports cucumber.yml profiles (#187 Ben Mabey)
27
+ * Field value steps for Webrat (Jack Chen)
28
+ * Added translation for Bulgarian (Krasimir Angelov)
29
+ * Updated translation for Polish (#273 Grzegorz Marszałek)
30
+ * Only a single World proc can be registered. World extension now happens by calling #World with ruby modules.
31
+ * Portuguese uses Funcionalidade in stead of Característica and accented words are aliased with unaccented ones (Alexandre da Silva and Felipe Coury).
32
+ * The usage formatter also prints unused step definitions (Aslak Hellesøy)
33
+ * Better exception if a World proc returns nil. (Aslak Hellesøy)
34
+ * Allow Step Definitions to use |*varargs|, but only on Ruby 1.9. (Aslak Hellesøy)
35
+ * Snippets for steps that use Step Tables or PyStrings include block param and object type hint comment (#247 Joseph Wilk)
36
+ * Support description string for Backgrounds (#271 Joseph Wilk)
37
+
38
+ === Bugfixes
39
+ * After methods not being executed when Background fails (#288 Luismi Cavallé)
40
+ * Fixed dependency on internal files in rspec breaks cucumber w/ rspec-1.2.4 (#291 Aslak Hellesøy)
41
+ * Fix color use when using autotest on Linux. (Hans de Graaff)
42
+ * Fixed incorrect calculation of pystring indentation (#279 Eugene Naydanov)
43
+ * Fixed --format html leads to an error (#252 Aslak Hellesøy)
44
+ * Fixed Background runs twice (#255 Aslak Hellesøy)
45
+ * Fixed Background Transactions and :xx (#270 Aslak Hellesøy)
46
+ * Fixed Autospec failing with cucumber 0.2 (#254 Aslak Hellesøy)
47
+ * Sibling file detecting not working (#278 Aslak Hellesøy)
48
+
49
+ === Removed/changed features
50
+ * The visitor API has changed slightly:
51
+ ** #visit_step_name, #visit_multiline_arg and #visit_exception are no longer official API methods.
52
+ ** #visit_step_result replaces those 3 methods.
53
+ ** Table and PyString no longer hold status information. Each visitor subclass should store state in @state if needed.
54
+ ** #visit_py_string no longer takes a status argument.
55
+
1
56
  == 0.2.3 2009-03-30
2
57
 
3
58
  This release sports 4 updated languages, slightly better help with snippets if you "quote" arguments
@@ -16,7 +71,7 @@ in your steps. Windows/JRuby users can enjoy colours and you get some more sugar
16
71
 
17
72
  === Bugfixes
18
73
  * Fixed step name after step keyword without space (#265 Aslak Hellesøy)
19
- * Backtrace is back in HTML reports
74
+ * Backtrace is back in HTML reports (Aslak Hellesøy)
20
75
 
21
76
  == 0.2.2 2009-03-25
22
77
 
@@ -21,6 +21,14 @@ examples/i18n/ar/Rakefile
21
21
  examples/i18n/ar/features/addition.feature
22
22
  examples/i18n/ar/features/step_definitons/calculator_steps.rb
23
23
  examples/i18n/ar/lib/calculator.rb
24
+ examples/i18n/bg/Rakefile
25
+ examples/i18n/bg/features/addition.feature
26
+ examples/i18n/bg/features/consecutive_calculations.feature
27
+ examples/i18n/bg/features/division.feature
28
+ examples/i18n/bg/features/step_definitons/calculator_steps.rb
29
+ examples/i18n/bg/features/support/env.rb
30
+ examples/i18n/bg/features/support/world.rb
31
+ examples/i18n/bg/lib/calculator.rb
24
32
  examples/i18n/da/Rakefile
25
33
  examples/i18n/da/features/step_definitons/kalkulator_steps.rb
26
34
  examples/i18n/da/features/summering.feature
@@ -108,6 +116,11 @@ examples/i18n/se/Rakefile
108
116
  examples/i18n/se/features/step_definitons/kalkulator_steps.rb
109
117
  examples/i18n/se/features/summering.feature
110
118
  examples/i18n/se/lib/kalkulator.rb
119
+ examples/i18n/sk/Rakefile
120
+ examples/i18n/sk/features/addition.feature
121
+ examples/i18n/sk/features/division.feature
122
+ examples/i18n/sk/features/step_definitons/calculator_steps.rb
123
+ examples/i18n/sk/lib/calculator.rb
111
124
  examples/i18n/zh-CN/Rakefile
112
125
  examples/i18n/zh-CN/features/addition.feature
113
126
  examples/i18n/zh-CN/features/step_definitons/calculator_steps.rb
@@ -135,6 +148,7 @@ examples/selenium_webrat/features/step_definitons/search_steps.rb
135
148
  examples/selenium_webrat/features/support/env.rb
136
149
  examples/self_test/README.textile
137
150
  examples/self_test/Rakefile
151
+ examples/self_test/features/background/background_with_name.feature
138
152
  examples/self_test/features/background/failing_background.feature
139
153
  examples/self_test/features/background/failing_background_after_success.feature
140
154
  examples/self_test/features/background/multiline_args_background.feature
@@ -151,6 +165,7 @@ examples/self_test/features/step_definitions/sample_steps.rb
151
165
  examples/self_test/features/support/env.rb
152
166
  examples/self_test/features/support/tag_count_formatter.rb
153
167
  examples/self_test/features/tons_of_cukes.feature
168
+ examples/self_test/features/undefined_multiline_args.feature
154
169
  examples/sinatra/Rakefile
155
170
  examples/sinatra/app.rb
156
171
  examples/sinatra/features/add.feature
@@ -162,16 +177,22 @@ examples/test_unit/Rakefile
162
177
  examples/test_unit/features/step_definitions/test_unit_steps.rb
163
178
  examples/test_unit/features/test_unit.feature
164
179
  examples/tickets/Rakefile
165
- examples/tickets/cucumber.yml
166
180
  examples/tickets/features/172.feature
167
181
  examples/tickets/features/177/1.feature
168
182
  examples/tickets/features/177/2.feature
169
183
  examples/tickets/features/177/3.feature
170
184
  examples/tickets/features/180.feature
185
+ examples/tickets/features/229/tagged_hooks.feature
186
+ examples/tickets/features/229/tagged_hooks.rb
171
187
  examples/tickets/features/236.feature
172
188
  examples/tickets/features/241.feature
173
189
  examples/tickets/features/246.feature
174
190
  examples/tickets/features/248.feature
191
+ examples/tickets/features/270/back.feature
192
+ examples/tickets/features/270/back.steps.rb
193
+ examples/tickets/features/279/py_string_indent.feature
194
+ examples/tickets/features/279/py_string_indent.steps.rb
195
+ examples/tickets/features/279/wrong.feature_
175
196
  examples/tickets/features/lib/eatting_machine.rb
176
197
  examples/tickets/features/lib/pantry.rb
177
198
  examples/tickets/features/scenario_outline.feature
@@ -190,7 +211,9 @@ features/cucumber_cli.feature
190
211
  features/cucumber_cli_diff_disabled.feature
191
212
  features/cucumber_cli_outlines.feature
192
213
  features/custom_formatter.feature
214
+ features/rake_task.feature
193
215
  features/report_called_undefined_steps.feature
216
+ features/snippet.feature
194
217
  features/step_definitions/cucumber_steps.rb
195
218
  features/step_definitions/extra_steps.rb
196
219
  features/support/env.rb
@@ -251,7 +274,6 @@ lib/cucumber/formatter/usage.rb
251
274
  lib/cucumber/formatters/unicode.rb
252
275
  lib/cucumber/languages.yml
253
276
  lib/cucumber/parser.rb
254
- lib/cucumber/parser/basic.rb
255
277
  lib/cucumber/parser/feature.rb
256
278
  lib/cucumber/parser/feature.tt
257
279
  lib/cucumber/parser/i18n.tt
@@ -278,50 +300,49 @@ rails_generators/feature/USAGE
278
300
  rails_generators/feature/feature_generator.rb
279
301
  rails_generators/feature/templates/feature.erb
280
302
  rails_generators/feature/templates/steps.erb
281
- specs/cucumber/ast/background_spec.rb
282
- specs/cucumber/ast/feature_factory.rb
283
- specs/cucumber/ast/feature_spec.rb
284
- specs/cucumber/ast/py_string_spec.rb
285
- specs/cucumber/ast/scenario_outline_spec.rb
286
- specs/cucumber/ast/scenario_spec.rb
287
- specs/cucumber/ast/step_collection_spec.rb
288
- specs/cucumber/ast/step_spec.rb
289
- specs/cucumber/ast/table_spec.rb
290
- specs/cucumber/ast/tags_spec.rb
291
- specs/cucumber/broadcaster_spec.rb
292
- specs/cucumber/cli/configuration_spec.rb
293
- specs/cucumber/cli/main_spec.rb
294
- specs/cucumber/core_ext/proc_spec.rb
295
- specs/cucumber/core_ext/string_spec.rb
296
- specs/cucumber/formatter/ansicolor_spec.rb
297
- specs/cucumber/formatter/color_io_spec.rb
298
- specs/cucumber/formatter/html/cucumber.css
299
- specs/cucumber/formatter/html/cucumber.js
300
- specs/cucumber/formatter/html/index.html
301
- specs/cucumber/formatter/html/jquery-1.3.min.js
302
- specs/cucumber/formatter/html/jquery.uitableedit.js
303
- specs/cucumber/formatters/profile_formatter_spec.rb
304
- specs/cucumber/parser/feature_parser_spec.rb
305
- specs/cucumber/parser/table_parser_spec.rb
306
- specs/cucumber/rails/stubs/mini_rails.rb
307
- specs/cucumber/rails/stubs/test_help.rb
308
- specs/cucumber/rails/world_spec.rb
309
- specs/cucumber/sell_cucumbers.feature
310
- specs/cucumber/step_definition_spec.rb
311
- specs/cucumber/step_mother_spec.rb
312
- specs/cucumber/treetop_parser/empty_feature.feature
313
- specs/cucumber/treetop_parser/empty_scenario.feature
314
- specs/cucumber/treetop_parser/empty_scenario_outline.feature
315
- specs/cucumber/treetop_parser/fit_scenario.feature
316
- specs/cucumber/treetop_parser/given_scenario.feature
317
- specs/cucumber/treetop_parser/invalid_scenario_outlines.feature
318
- specs/cucumber/treetop_parser/multiline_steps.feature
319
- specs/cucumber/treetop_parser/multiple_tables.feature
320
- specs/cucumber/treetop_parser/scenario_outline.feature
321
- specs/cucumber/treetop_parser/spaces.feature
322
- specs/cucumber/treetop_parser/test_dos.feature
323
- specs/cucumber/treetop_parser/with_comments.feature
324
- specs/cucumber/treetop_parser/with_tags.feature
325
- specs/cucumber/world/pending_spec.rb
326
- specs/spec.opts
327
- specs/spec_helper.rb
303
+ spec/cucumber/ast/background_spec.rb
304
+ spec/cucumber/ast/feature_factory.rb
305
+ spec/cucumber/ast/feature_spec.rb
306
+ spec/cucumber/ast/py_string_spec.rb
307
+ spec/cucumber/ast/scenario_outline_spec.rb
308
+ spec/cucumber/ast/scenario_spec.rb
309
+ spec/cucumber/ast/step_collection_spec.rb
310
+ spec/cucumber/ast/step_spec.rb
311
+ spec/cucumber/ast/table_spec.rb
312
+ spec/cucumber/broadcaster_spec.rb
313
+ spec/cucumber/cli/configuration_spec.rb
314
+ spec/cucumber/cli/main_spec.rb
315
+ spec/cucumber/core_ext/proc_spec.rb
316
+ spec/cucumber/core_ext/string_spec.rb
317
+ spec/cucumber/formatter/ansicolor_spec.rb
318
+ spec/cucumber/formatter/color_io_spec.rb
319
+ spec/cucumber/formatter/html/cucumber.css
320
+ spec/cucumber/formatter/html/cucumber.js
321
+ spec/cucumber/formatter/html/index.html
322
+ spec/cucumber/formatter/html/jquery-1.3.min.js
323
+ spec/cucumber/formatter/html/jquery.uitableedit.js
324
+ spec/cucumber/formatters/profile_formatter_spec.rb
325
+ spec/cucumber/parser/feature_parser_spec.rb
326
+ spec/cucumber/parser/table_parser_spec.rb
327
+ spec/cucumber/rails/stubs/mini_rails.rb
328
+ spec/cucumber/rails/stubs/test_help.rb
329
+ spec/cucumber/rails/world_spec.rb
330
+ spec/cucumber/sell_cucumbers.feature
331
+ spec/cucumber/step_definition_spec.rb
332
+ spec/cucumber/step_mother_spec.rb
333
+ spec/cucumber/treetop_parser/empty_feature.feature
334
+ spec/cucumber/treetop_parser/empty_scenario.feature
335
+ spec/cucumber/treetop_parser/empty_scenario_outline.feature
336
+ spec/cucumber/treetop_parser/fit_scenario.feature
337
+ spec/cucumber/treetop_parser/given_scenario.feature
338
+ spec/cucumber/treetop_parser/invalid_scenario_outlines.feature
339
+ spec/cucumber/treetop_parser/multiline_steps.feature
340
+ spec/cucumber/treetop_parser/multiple_tables.feature
341
+ spec/cucumber/treetop_parser/scenario_outline.feature
342
+ spec/cucumber/treetop_parser/spaces.feature
343
+ spec/cucumber/treetop_parser/test_dos.feature
344
+ spec/cucumber/treetop_parser/with_comments.feature
345
+ spec/cucumber/treetop_parser/with_tags.feature
346
+ spec/cucumber/world/pending_spec.rb
347
+ spec/spec.opts
348
+ spec/spec_helper.rb
@@ -53,7 +53,7 @@ $hoe = Hoe.new(GEM_NAME, VERS) do |p|
53
53
  p.summary = DESCRIPTION
54
54
  p.url = HOMEPATH
55
55
  p.rubyforge_name = RUBYFORGE_PROJECT if RUBYFORGE_PROJECT
56
- p.clean_globs |= ['**/.*.sw?', '*.gem', '.config', '**/.DS_Store', '**/*.class', '**/*.jar'] #An array of file patterns to delete on clean.
56
+ p.clean_globs |= ['**/.*.sw?', '*.gem', '.config', '**/.DS_Store', '**/*.class', '**/*.jar', '**/tmp'] #An array of file patterns to delete on clean.
57
57
 
58
58
  # == Optional
59
59
  p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
@@ -1 +1 @@
1
- default: --format progress features
1
+ default: --format progress features --tags ~@pending
@@ -0,0 +1,6 @@
1
+ $:.unshift(File.dirname(__FILE__) + '/../../../lib')
2
+ require 'cucumber/rake/task'
3
+
4
+ Cucumber::Rake::Task.new do |t|
5
+ t.cucumber_opts = "--language bg"
6
+ end
@@ -0,0 +1,11 @@
1
+ Функционалност: Събиране на числа
2
+ За да не го правят наум
3
+ Потребителите
4
+ Трябва да могат да събират числа с калкулатора
5
+
6
+ Сценарий: Събиране на две цели числа
7
+ Дадено е че съм въвел 50
8
+ И съм въвел 70
9
+ Когато натисна "+"
10
+ То резултата трябва да е равен на 120
11
+
@@ -0,0 +1,18 @@
1
+ Функционалост: Последователни изчисления
2
+ За да не го правят наум
3
+ Потребителите
4
+ Трябва да могат да извършват последователни изчисления с калкулатора
5
+
6
+ Предистория:
7
+ Дадено е че съм събрал 3 и 5
8
+
9
+ Сценарий: събиране с резултата от последната операция
10
+ Когато въведа 4
11
+ И натисна "+"
12
+ То резултата трябва да е равен на 12
13
+
14
+ Сценарий: делене с резултата от последната операция
15
+ Когато въведа 2
16
+ И натисна "/"
17
+ То резултата трябва да е равен на 4
18
+
@@ -0,0 +1,16 @@
1
+ Фунцкционалност: Делене на числа
2
+ За да не го правят наум
3
+ Потребителите
4
+ Трябва да могат да разделят числа с калкулатора
5
+
6
+ Рамка на сценарий: Делене на цели числа
7
+ Дадено е че съм въвел <делимо>
8
+ И е че съм въвел <делител>
9
+ Когато натисна "/"
10
+ То резултата трябва да е равен на <частно>
11
+
12
+ Примери:
13
+ | делимо | делител | частно |
14
+ | 100 | 2 | 50 |
15
+ | 28 | 7 | 4 |
16
+ | 0 | 5 | 0 |
@@ -0,0 +1,24 @@
1
+ # encoding: utf-8
2
+
3
+ Дадено /въвел (\d+)/ do |x|
4
+ calc.push x.to_i
5
+ end
6
+
7
+ Когато /^въведа (\d+)/ do |x|
8
+ calc.push x.to_i
9
+ end
10
+
11
+ Когато /натисна "(.*)"/ do |op|
12
+ calc.send op
13
+ end
14
+
15
+ То /резултата трябва да е равен на (\d+)/ do |result|
16
+ calc.result.should == result.to_f
17
+ end
18
+
19
+ Дадено /събрал (\d+) и (\d+)/ do |x, y|
20
+ Дадено %{въвел #{x}}
21
+ Дадено %{въвел #{y}}
22
+ Дадено %{натисна "+"}
23
+ end
24
+
@@ -0,0 +1,6 @@
1
+ # encoding: utf-8
2
+ require 'spec/expectations'
3
+ $:.unshift(File.dirname(__FILE__) + '/../../lib')
4
+ require 'cucumber/formatter/unicode'
5
+ require 'calculator'
6
+ $KCODE='u' unless Cucumber::RUBY_1_9
@@ -0,0 +1,8 @@
1
+ # encoding: utf-8
2
+ module LazyCalc
3
+ def calc
4
+ @calc ||= Calculator.new
5
+ end
6
+ end
7
+
8
+ World(LazyCalc)
@@ -0,0 +1,24 @@
1
+ # encoding: utf-8
2
+
3
+ class Calculator
4
+ def initialize
5
+ @stack = []
6
+ end
7
+
8
+ def push(arg)
9
+ @stack.push arg
10
+ end
11
+
12
+ def result
13
+ @stack.last
14
+ end
15
+
16
+ def +
17
+ @stack.push @stack.pop + @stack.pop
18
+ end
19
+
20
+ def /
21
+ divisor, dividend = [@stack.pop, @stack.pop] # Hm, @stack.pop(2) doesn't work
22
+ @stack.push dividend / divisor
23
+ end
24
+ end
@@ -1,7 +1,8 @@
1
1
  # encoding: utf-8
2
-
3
- World do
2
+ module LazyCalc
4
3
  def calc
5
4
  @calc ||= Calculator.new
6
5
  end
7
- end
6
+ end
7
+
8
+ World(LazyCalc)
@@ -0,0 +1,6 @@
1
+ $:.unshift(File.dirname(__FILE__) + '/../../../lib')
2
+ require 'cucumber/rake/task'
3
+
4
+ Cucumber::Rake::Task.new do |t|
5
+ t.cucumber_opts = "--language sk"
6
+ end
@@ -0,0 +1,16 @@
1
+ Požiadavka: Sčítavanie
2
+ Aby som sa vyhol hlúpym chybám
3
+ Ako matematický idiot
4
+ Chcem vedieť ako sa sčítavajú dve čísla
5
+
6
+ Náčrt Scenáru: Sčítanie dvoch čísel
7
+ Pokiaľ Zadám číslo <vstup_1> do kalkulačky
8
+ A Zadám číslo <vstup_2> do kalkulačky
9
+ Keď Stlačím tlačidlo <tlačidlo>
10
+ Tak Výsledok by mal byť <výstup>
11
+
12
+ Príklady:
13
+ | vstup_1 | vstup_2 | tlačidlo | výstup |
14
+ | 20 | 30 | add | 50 |
15
+ | 2 | 5 | add | 7 |
16
+ | 0 | 40 | add | 40 |
@@ -0,0 +1,9 @@
1
+ Požiadavka: Delenie
2
+ Aby som sa vyhol hlúpym chybám
3
+ Pokladníci musia vedieť vypočítať podiel
4
+
5
+ Scenár: Prirodzené čísla
6
+ Pokiaľ Zadám číslo 3 do kalkulačky
7
+ A Zadám číslo 2 do kalkulačky
8
+ Keď Stlačím tlačidlo divide
9
+ Tak Výsledok by mal byť 1.5
@@ -0,0 +1,24 @@
1
+ # encoding: utf-8
2
+ require 'spec/expectations'
3
+ $:.unshift(File.dirname(__FILE__) + '/../../lib') # This line is not needed in your own project
4
+ require 'cucumber/formatter/unicode'
5
+ require 'calculator'
6
+
7
+ Before do
8
+ @calc = Calculator.new
9
+ end
10
+
11
+ After do
12
+ end
13
+
14
+ Given /Zadám číslo (\d+) do kalkulačky/ do |n|
15
+ @calc.push n.to_i
16
+ end
17
+
18
+ When /Stlačím tlačidlo (\w+)/ do |op|
19
+ @result = @calc.send op
20
+ end
21
+
22
+ Then /Výsledok by mal byť (.*)/ do |result|
23
+ @result.should == result.to_f
24
+ end