aslakhellesoy-cucumber 0.1.12 → 0.1.13
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +38 -3
- data/Manifest.txt +17 -1
- data/README.txt +2 -39
- data/bin/cucumber +1 -1
- data/examples/calculator_ruby_features/features/addition.rb +16 -0
- data/examples/i18n/ar/features/step_definitons/calculator_steps.rb +1 -1
- data/examples/i18n/da/features/step_definitons/kalkulator_steps.rb +1 -0
- data/examples/i18n/de/features/step_definitons/calculator_steps.rb +1 -0
- data/examples/i18n/en/features/step_definitons/calculator_steps.rb +1 -0
- data/examples/i18n/es/features/step_definitons/calculador_steps.rb +1 -0
- data/examples/i18n/et/features/step_definitions/kalkulaator_steps.rb +1 -0
- data/examples/i18n/fr/features/addition.feature +13 -11
- data/examples/i18n/fr/features/step_definitions/calculatrice_steps.rb +6 -2
- data/examples/i18n/id/features/step_definitons/calculator_steps.rb +1 -0
- data/examples/i18n/it/features/step_definitons/calcolatrice_steps.rb +1 -0
- data/examples/i18n/ja/features/step_definitons/calculator_steps.rb +2 -0
- data/examples/i18n/lt/features/step_definitons/calculator_steps.rb +1 -0
- data/examples/i18n/no/features/step_definitons/kalkulator_steps.rb +1 -0
- data/examples/i18n/pt/features/step_definitions/calculadora_steps.rb +1 -0
- data/examples/i18n/ro/features/step_definitons/calculator_steps.rb +1 -0
- data/examples/i18n/se/features/step_definitons/kalkulator_steps.rb +1 -0
- data/examples/i18n/zh-CN/features/step_definitons/calculator_steps.rb +1 -0
- data/examples/selenium/features/search.feature +1 -1
- data/examples/selenium/features/step_definitons/stories_steps.rb +2 -3
- data/examples/tickets/features/lib/eatting_machine.rb +18 -0
- data/examples/tickets/features/lib/pantry.rb +20 -0
- data/examples/tickets/features/scenario_outline.feature +64 -0
- data/examples/tickets/features/step_definitons/scenario_outline_steps.rb +34 -0
- data/examples/tickets/features/step_definitons/tickets_steps.rb +4 -0
- data/gem_tasks/fix_cr_lf.rake +1 -1
- data/gem_tasks/yard.rake +8 -0
- data/lib/autotest/cucumber_mixin.rb +3 -3
- data/lib/cucumber/broadcaster.rb +1 -1
- data/lib/cucumber/cli.rb +87 -42
- data/lib/cucumber/core_ext/exception.rb +20 -0
- data/lib/cucumber/core_ext/string.rb +1 -1
- data/lib/cucumber/executor.rb +35 -18
- data/lib/cucumber/formatters/ansicolor.rb +65 -74
- data/lib/cucumber/formatters/html_formatter.rb +33 -10
- data/lib/cucumber/formatters/pretty_formatter.rb +58 -16
- data/lib/cucumber/formatters/progress_formatter.rb +3 -0
- data/lib/cucumber/formatters/unicode.rb +27 -0
- data/lib/cucumber/languages.yml +6 -4
- data/lib/cucumber/platform.rb +1 -0
- data/lib/cucumber/rails/world.rb +6 -6
- data/lib/cucumber/step_mother.rb +3 -0
- data/lib/cucumber/tree/feature.rb +28 -2
- data/lib/cucumber/tree/scenario.rb +62 -1
- data/lib/cucumber/tree/step.rb +32 -1
- data/lib/cucumber/treetop_parser/feature.treetop.erb +54 -7
- data/lib/cucumber/treetop_parser/feature_ar.rb +377 -18
- data/lib/cucumber/treetop_parser/feature_cy.rb +377 -18
- data/lib/cucumber/treetop_parser/feature_da.rb +377 -18
- data/lib/cucumber/treetop_parser/feature_de.rb +377 -18
- data/lib/cucumber/treetop_parser/feature_en-lol.rb +377 -18
- data/lib/cucumber/treetop_parser/feature_en-tx.rb +377 -18
- data/lib/cucumber/treetop_parser/feature_en.rb +377 -18
- data/lib/cucumber/treetop_parser/feature_es.rb +377 -18
- data/lib/cucumber/treetop_parser/feature_et.rb +377 -18
- data/lib/cucumber/treetop_parser/feature_fr.rb +389 -30
- data/lib/cucumber/treetop_parser/feature_id.rb +377 -18
- data/lib/cucumber/treetop_parser/feature_it.rb +377 -18
- data/lib/cucumber/treetop_parser/feature_ja.rb +377 -18
- data/lib/cucumber/treetop_parser/feature_lt.rb +377 -18
- data/lib/cucumber/treetop_parser/feature_nl.rb +377 -18
- data/lib/cucumber/treetop_parser/feature_no.rb +377 -18
- data/lib/cucumber/treetop_parser/feature_pl.rb +377 -18
- data/lib/cucumber/treetop_parser/feature_pt.rb +377 -18
- data/lib/cucumber/treetop_parser/feature_ro.rb +377 -18
- data/lib/cucumber/treetop_parser/feature_ro2.rb +377 -18
- data/lib/cucumber/treetop_parser/feature_ru.rb +377 -18
- data/lib/cucumber/treetop_parser/feature_se.rb +377 -18
- data/lib/cucumber/treetop_parser/feature_zh-CN.rb +377 -18
- data/lib/cucumber/version.rb +1 -1
- data/lib/cucumber/world/pending.rb +22 -0
- data/lib/cucumber/world.rb +1 -0
- data/lib/cucumber.rb +2 -0
- data/rails_generators/cucumber/templates/env.rb +1 -0
- data/rails_generators/feature/feature_generator.rb +22 -2
- data/rails_generators/feature/templates/feature.erb +15 -12
- data/rails_generators/feature/templates/steps.erb +16 -14
- data/spec/cucumber/cli_spec.rb +87 -6
- data/spec/cucumber/executor_spec.rb +102 -30
- data/spec/cucumber/formatters/ansicolor_spec.rb +10 -10
- data/spec/cucumber/formatters/html_formatter_spec.rb +30 -0
- data/spec/cucumber/formatters/pretty_formatter_spec.rb +139 -4
- data/spec/cucumber/formatters/progress_formatter_spec.rb +16 -0
- data/spec/cucumber/tree/feature_spec.rb +84 -5
- data/spec/cucumber/tree/row_scenario_outline_spec.rb +73 -0
- data/spec/cucumber/tree/row_step_outline_spec.rb +38 -0
- data/spec/cucumber/tree/scenario_outline_spec.rb +50 -0
- data/spec/cucumber/tree/step_outline_spec.rb +17 -0
- data/spec/cucumber/tree/step_spec.rb +9 -0
- data/spec/cucumber/treetop_parser/empty_scenario_outline.feature +3 -0
- data/spec/cucumber/treetop_parser/feature_parser_spec.rb +22 -0
- data/spec/cucumber/treetop_parser/invalid_scenario_outlines.feature +7 -0
- data/spec/cucumber/treetop_parser/scenario_outline.feature +16 -0
- data/spec/cucumber/world/pending_spec.rb +46 -0
- data/spec/spec_helper.rb +2 -1
- metadata +19 -4
- data/TODO.txt +0 -26
data/History.txt
CHANGED
@@ -1,3 +1,38 @@
|
|
1
|
+
== 0.1.13 2008-12-20
|
2
|
+
|
3
|
+
It's time for some new features again. Output is now much better since you can use diffing, tweak
|
4
|
+
the output colours and get the full --backtrace if you want. Managing your support/* files became
|
5
|
+
a little easier since they are now always loaded before the step definitions. Life became easier
|
6
|
+
for Windows users in Norway (and other countries using unicode in the features). Plus several other
|
7
|
+
bug fixes.
|
8
|
+
|
9
|
+
Enjoy!
|
10
|
+
|
11
|
+
=== New features
|
12
|
+
* Console output is no longer bold, but regular. Step arguments are bold instead of blold+underlined. (Aslak Hellesøy)
|
13
|
+
* Console output can be configured with CUCUMBER_COLORS in your shell. (Aslak Hellesøy)
|
14
|
+
* Added new --backtrace option to show full backtrace (Aslak Hellesøy)
|
15
|
+
* Enable RSpec's diffing automatically if RSpec is loaded (Aslak Hellesøy)
|
16
|
+
* Files in support directories are loaded before any other file (i.e. step definitions.) (#120, Ben Mabey)
|
17
|
+
* The Rails features generator got some love and is now tested: http://github.com/aslakhellesoy/cucumber_rails (Aslak Hellesøy)
|
18
|
+
* --language is aliased to -l instead of -a (-l became available when --line was refactored) (Aslak Hellesøy)
|
19
|
+
* Scenario Outlines which through placeholders in the steps allow control of how scenario table values are used. (#57 Joseph Wilk)
|
20
|
+
* Scenario Outlines are now usable in pure ruby (Joseph Wilk)
|
21
|
+
* Add support for calling 'pending' from step definitions. (#112 Joseph Wilk)
|
22
|
+
|
23
|
+
=== Bugfixes
|
24
|
+
* Make rails before filters work correctly (#122, #129 Guillermo Álvarez Fernández)
|
25
|
+
* Proper Unicode support for Windows command shells: Just require cucumber/formatter/unicode in env.rb (Aslak Hellesøy)
|
26
|
+
* Fixed disappearing "a" on Windows (#81 Aslak Hellesøy)
|
27
|
+
* Fixed a bug where row step outlines were loosing step tables. (#121 Joseph Wilk, Ben Mabey)
|
28
|
+
* The Cucumber Autotest plugin now launches JRuby if autotest is run with JRuby (Aslak Hellesøy)
|
29
|
+
* Provide helpful and non-confusing error message when specified profile is blank. (#118, Ben Mabey)
|
30
|
+
* Improve handling and error messages for malformed cucumber.yml files. (#117, Ben Mabey)
|
31
|
+
* document :x run option in command line help (#114, Aslak Hellesøy)
|
32
|
+
* Change 'visits' to 'visit' in features generator to comply with new Webrat API (Darius Roberts)
|
33
|
+
|
34
|
+
=== Removed features
|
35
|
+
|
1
36
|
== 0.1.12 2008-12-04
|
2
37
|
|
3
38
|
This is the "getting serious with IronRuby release" - largely based on
|
@@ -17,18 +52,18 @@ None
|
|
17
52
|
|
18
53
|
Bugfix release with a couple of minor additional features to the command line options.
|
19
54
|
|
20
|
-
|
55
|
+
=== New features
|
21
56
|
* Capture output from cucumber in Autotest (Alan Larkin)
|
22
57
|
* Update cucumber generator to work with latest Webrat (Bryan Helkamp)
|
23
58
|
* CUCUMBR LIKEZ 2 SPEEK WIF KATS. KTHXBAI (Aimee Daniells)
|
24
59
|
* Support for dynamically pluggable formatters (#99 Joseph Wilk)
|
25
60
|
* --verbose mode to see ruby files and feature files loaded by Cucumber (#106 Joseph Wilk)
|
26
61
|
|
27
|
-
|
62
|
+
=== Bugfixes
|
28
63
|
* The jcode library is not loaded on JRuby/Rails. Workaround for http://tinyurl.com/55uu3u. (Aslak Hellesøy)
|
29
64
|
* Support including modules for class passed to --format (#109 Joseph Wilk)
|
30
65
|
|
31
|
-
|
66
|
+
=== Removed features
|
32
67
|
* The cucumber gem no longer depends on the rspec gem. It must be downloaded manually if RSpec is used. (Jeff Rafter)
|
33
68
|
|
34
69
|
== 0.1.10 2008-11-25
|
data/Manifest.txt
CHANGED
@@ -3,7 +3,6 @@ License.txt
|
|
3
3
|
Manifest.txt
|
4
4
|
README.txt
|
5
5
|
Rakefile
|
6
|
-
TODO.txt
|
7
6
|
bin/cucumber
|
8
7
|
config/hoe.rb
|
9
8
|
config/requirements.rb
|
@@ -106,6 +105,10 @@ examples/test_unit/features/step_definitions/test_unit_steps.rb
|
|
106
105
|
examples/test_unit/features/test_unit.feature
|
107
106
|
examples/tickets/Rakefile
|
108
107
|
examples/tickets/cucumber.yml
|
108
|
+
examples/tickets/features/lib/eatting_machine.rb
|
109
|
+
examples/tickets/features/lib/pantry.rb
|
110
|
+
examples/tickets/features/scenario_outline.feature
|
111
|
+
examples/tickets/features/step_definitons/scenario_outline_steps.rb
|
109
112
|
examples/tickets/features/step_definitons/tickets_steps.rb
|
110
113
|
examples/tickets/features/tickets.feature
|
111
114
|
examples/watir/Rakefile
|
@@ -121,6 +124,7 @@ gem_tasks/flog.rake
|
|
121
124
|
gem_tasks/gemspec.rake
|
122
125
|
gem_tasks/rspec.rake
|
123
126
|
gem_tasks/treetop.rake
|
127
|
+
gem_tasks/yard.rake
|
124
128
|
lib/autotest/cucumber.rb
|
125
129
|
lib/autotest/cucumber_mixin.rb
|
126
130
|
lib/autotest/cucumber_rails.rb
|
@@ -130,6 +134,7 @@ lib/autotest/discover.rb
|
|
130
134
|
lib/cucumber.rb
|
131
135
|
lib/cucumber/broadcaster.rb
|
132
136
|
lib/cucumber/cli.rb
|
137
|
+
lib/cucumber/core_ext/exception.rb
|
133
138
|
lib/cucumber/core_ext/proc.rb
|
134
139
|
lib/cucumber/core_ext/string.rb
|
135
140
|
lib/cucumber/executor.rb
|
@@ -143,6 +148,7 @@ lib/cucumber/formatters/jquery.js
|
|
143
148
|
lib/cucumber/formatters/pretty_formatter.rb
|
144
149
|
lib/cucumber/formatters/profile_formatter.rb
|
145
150
|
lib/cucumber/formatters/progress_formatter.rb
|
151
|
+
lib/cucumber/formatters/unicode.rb
|
146
152
|
lib/cucumber/languages.yml
|
147
153
|
lib/cucumber/model.rb
|
148
154
|
lib/cucumber/model/table.rb
|
@@ -186,6 +192,8 @@ lib/cucumber/treetop_parser/feature_ru.rb
|
|
186
192
|
lib/cucumber/treetop_parser/feature_se.rb
|
187
193
|
lib/cucumber/treetop_parser/feature_zh-CN.rb
|
188
194
|
lib/cucumber/version.rb
|
195
|
+
lib/cucumber/world.rb
|
196
|
+
lib/cucumber/world/pending.rb
|
189
197
|
rails_generators/cucumber/USAGE
|
190
198
|
rails_generators/cucumber/cucumber_generator.rb
|
191
199
|
rails_generators/cucumber/templates/cucumber
|
@@ -224,18 +232,26 @@ spec/cucumber/rails/world_spec.rb
|
|
224
232
|
spec/cucumber/sell_cucumbers.feature
|
225
233
|
spec/cucumber/step_mother_spec.rb
|
226
234
|
spec/cucumber/tree/feature_spec.rb
|
235
|
+
spec/cucumber/tree/row_scenario_outline_spec.rb
|
227
236
|
spec/cucumber/tree/row_scenario_spec.rb
|
237
|
+
spec/cucumber/tree/row_step_outline_spec.rb
|
238
|
+
spec/cucumber/tree/scenario_outline_spec.rb
|
228
239
|
spec/cucumber/tree/scenario_spec.rb
|
240
|
+
spec/cucumber/tree/step_outline_spec.rb
|
229
241
|
spec/cucumber/tree/step_spec.rb
|
230
242
|
spec/cucumber/treetop_parser/empty_feature.feature
|
231
243
|
spec/cucumber/treetop_parser/empty_scenario.feature
|
244
|
+
spec/cucumber/treetop_parser/empty_scenario_outline.feature
|
232
245
|
spec/cucumber/treetop_parser/feature_parser_spec.rb
|
233
246
|
spec/cucumber/treetop_parser/fit_scenario.feature
|
234
247
|
spec/cucumber/treetop_parser/given_scenario.feature
|
248
|
+
spec/cucumber/treetop_parser/invalid_scenario_outlines.feature
|
235
249
|
spec/cucumber/treetop_parser/multiline_steps.feature
|
236
250
|
spec/cucumber/treetop_parser/multiple_tables.feature
|
251
|
+
spec/cucumber/treetop_parser/scenario_outline.feature
|
237
252
|
spec/cucumber/treetop_parser/spaces.feature
|
238
253
|
spec/cucumber/treetop_parser/test_dos.feature
|
239
254
|
spec/cucumber/treetop_parser/with_comments.feature
|
255
|
+
spec/cucumber/world/pending_spec.rb
|
240
256
|
spec/spec.opts
|
241
257
|
spec/spec_helper.rb
|
data/README.txt
CHANGED
@@ -1,41 +1,4 @@
|
|
1
1
|
= Cucumber
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
== DESCRIPTION:
|
6
|
-
|
7
|
-
Cucumber executes plain text documentation of code against that code.
|
8
|
-
Documentation: http://github.com/aslakhellesoy/cucumber/wikis/home
|
9
|
-
|
10
|
-
== REQUIREMENTS:
|
11
|
-
|
12
|
-
* FIX (list of requirements)
|
13
|
-
|
14
|
-
== INSTALL:
|
15
|
-
|
16
|
-
* gem install cucumber
|
17
|
-
|
18
|
-
== LICENSE:
|
19
|
-
|
20
|
-
(The MIT License)
|
21
|
-
|
22
|
-
Copyright (c) 2008 Aslak Hellesøy
|
23
|
-
|
24
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
25
|
-
a copy of this software and associated documentation files (the
|
26
|
-
'Software'), to deal in the Software without restriction, including
|
27
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
28
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
29
|
-
permit persons to whom the Software is furnished to do so, subject to
|
30
|
-
the following conditions:
|
31
|
-
|
32
|
-
The above copyright notice and this permission notice shall be
|
33
|
-
included in all copies or substantial portions of the Software.
|
34
|
-
|
35
|
-
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
36
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
37
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
38
|
-
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
39
|
-
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
40
|
-
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
41
|
-
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
3
|
+
Please see the "wiki":http://github.com/aslakhellesoy/cucumber/wikis/home
|
4
|
+
for documentation.
|
data/bin/cucumber
CHANGED
@@ -20,4 +20,20 @@ Feature %|Addition
|
|
20
20
|
t | n | n*2 | n*3 | Fixnum | t
|
21
21
|
end
|
22
22
|
end
|
23
|
+
|
24
|
+
ScenarioOutline "Add two numbers" do
|
25
|
+
Given "I have entered <input_1> into the calculator"
|
26
|
+
And "I have entered <input_2> into the calculator"
|
27
|
+
When "I add"
|
28
|
+
Then "the result should be <output> on the screen"
|
29
|
+
And "the result class should be <class>"
|
30
|
+
end
|
31
|
+
|
32
|
+
Table do |t|
|
33
|
+
t | "input_1" | "input_2" | "output" | "class" | t
|
34
|
+
10.times do |n|
|
35
|
+
t | n | n*2 | n*3 | Fixnum | t
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
23
39
|
end
|
@@ -1,13 +1,15 @@
|
|
1
|
-
|
2
|
-
Afin
|
3
|
-
|
4
|
-
Je
|
1
|
+
Fonctionnalité: Addition
|
2
|
+
Afin de financer mon bonus avec l'argent des pigeons
|
3
|
+
En tant que trader
|
4
|
+
Je souhaite pouvoir additionner 2 chiffres
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
Et que
|
9
|
-
|
10
|
-
Scenario: Additionner
|
11
|
-
SoitScenario: 7 et 5
|
6
|
+
Scénario: Addition de produits dérivés
|
7
|
+
Etant donné que je tape 2
|
8
|
+
Et que je tape 1
|
12
9
|
Lorsque je tape additionner
|
13
|
-
Alors le
|
10
|
+
Alors le résultat doit être 3
|
11
|
+
|
12
|
+
Plus d'exemples:
|
13
|
+
| a | b | sum |
|
14
|
+
| 2 | 2 | 4 |
|
15
|
+
| 2 | 3 | 5 |
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'spec'
|
2
2
|
$:.unshift(File.dirname(__FILE__) + '/../../lib')
|
3
|
+
require 'cucumber/formatters/unicode'
|
3
4
|
require 'calculatrice'
|
4
5
|
|
5
6
|
Before do
|
@@ -9,14 +10,17 @@ end
|
|
9
10
|
After do
|
10
11
|
end
|
11
12
|
|
12
|
-
|
13
|
+
# Etant donné que je tape ...
|
14
|
+
Given /que je tape (\d+)/ do |n|
|
13
15
|
@calc.push n.to_i
|
14
16
|
end
|
15
17
|
|
18
|
+
# Lorsque je tape additionner
|
16
19
|
When 'je tape additionner' do
|
17
20
|
@result = @calc.additionner
|
18
21
|
end
|
19
22
|
|
20
|
-
|
23
|
+
# Alors le résultat doit être ...
|
24
|
+
Then /le résultat doit être (\d*)/ do |result|
|
21
25
|
@result.should == result.to_i
|
22
26
|
end
|
@@ -35,7 +35,6 @@ When /I search for "(.*)"/ do |query|
|
|
35
35
|
@page.search(query)
|
36
36
|
end
|
37
37
|
|
38
|
-
Then /I should see a link to
|
39
|
-
|
40
|
-
observed_url.should == expected_url
|
38
|
+
Then /I should see a link to (.*)/ do |expected_url|
|
39
|
+
@browser.is_element_present("css=a[href='#{expected_url}']").should be_true
|
41
40
|
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
class EattingMachine
|
2
|
+
|
3
|
+
attr_reader :fruit_total, :belly_count
|
4
|
+
attr_accessor :belly_count
|
5
|
+
|
6
|
+
def initialize(fruit_name, fruit_total)
|
7
|
+
@fruit_name = fruit_name
|
8
|
+
@fruit_total = fruit_total.to_i
|
9
|
+
@belly_count = 0
|
10
|
+
end
|
11
|
+
|
12
|
+
def eat(count)
|
13
|
+
count = count.to_i
|
14
|
+
@fruit_total = @fruit_total - count
|
15
|
+
@belly_count += count
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
class Pantry
|
2
|
+
|
3
|
+
def initialize
|
4
|
+
@items = {}
|
5
|
+
end
|
6
|
+
|
7
|
+
def add(food_name, count)
|
8
|
+
@items[food_name] ||= 0
|
9
|
+
@items[food_name] += count.to_i
|
10
|
+
end
|
11
|
+
|
12
|
+
def remove(food_name, count)
|
13
|
+
@items[food_name] -= count.to_i
|
14
|
+
end
|
15
|
+
|
16
|
+
def count(food_name)
|
17
|
+
@items[food_name]
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
Feature: Outlines
|
2
|
+
In order to re-use scenario table values
|
3
|
+
As a citizen of Cucumbia
|
4
|
+
I want to explicitly mark the parameters in a scenario outline
|
5
|
+
|
6
|
+
Scenario Outline: controlling order
|
7
|
+
Given there are <start> cucumbers
|
8
|
+
When I eat <eat> cucumbers
|
9
|
+
Then I should have <left> cucumbers
|
10
|
+
|
11
|
+
Examples:
|
12
|
+
| left | start | eat |
|
13
|
+
| 7 | 12 | 5 |
|
14
|
+
| 15 | 20 | 5 |
|
15
|
+
|
16
|
+
Scenario Outline: reusing place holder
|
17
|
+
Given there are <start> cucumbers
|
18
|
+
When I eat <eat> cucumbers
|
19
|
+
Then I should have <left> cucumbers
|
20
|
+
And I should have <eat> cucumbers in my belly
|
21
|
+
|
22
|
+
Examples:
|
23
|
+
| start | eat | left |
|
24
|
+
| 12 | 5 | 7 |
|
25
|
+
| 20 | 5 | 15 |
|
26
|
+
|
27
|
+
Scenario Outline: no placeholders
|
28
|
+
Given there are 12 cucumbers
|
29
|
+
When I eat 5 cucumbers
|
30
|
+
Then I should have 7 cucumbers
|
31
|
+
|
32
|
+
Examples:
|
33
|
+
| start | eat | left |
|
34
|
+
| 12 | 5 | 7 |
|
35
|
+
| 20 | 5 | 15 |
|
36
|
+
|
37
|
+
Scenario Outline: using '<' and '>' not as placeholder
|
38
|
+
Given the belly space is < 12 and > 6
|
39
|
+
And there are <start> cucumbers
|
40
|
+
When I eat <eat> cucumbers
|
41
|
+
Then I should have <left> cucumbers
|
42
|
+
|
43
|
+
Examples:
|
44
|
+
| start | eat | left |
|
45
|
+
| 12 | 5 | 7 |
|
46
|
+
| 20 | 5 | 15 |
|
47
|
+
|
48
|
+
Scenario Outline: with step tables
|
49
|
+
Given I have the following fruits in my pantry
|
50
|
+
| name | quantity |
|
51
|
+
| cucumbers | 10 |
|
52
|
+
| strawberrys | 5 |
|
53
|
+
| apricots | 7 |
|
54
|
+
|
55
|
+
When I eat <number> <fruits> from the pantry
|
56
|
+
Then I should have <left> <fruits> in the pantry
|
57
|
+
|
58
|
+
Examples:
|
59
|
+
| number | fruits | left |
|
60
|
+
| 2 | cucumbers | 8 |
|
61
|
+
| 4 | strawberrys| 1 |
|
62
|
+
| 2 | apricots | 5 |
|
63
|
+
|
64
|
+
|
@@ -0,0 +1,34 @@
|
|
1
|
+
Given /^there are (\d+) (\w+)$/ do |count, fruit|
|
2
|
+
@eattingMachine = EattingMachine.new(fruit, count)
|
3
|
+
end
|
4
|
+
|
5
|
+
Given "the belly space is < 12 and > 6" do
|
6
|
+
end
|
7
|
+
|
8
|
+
Given "I have the following fruits in my pantry" do |pantry_table|
|
9
|
+
@pantry = Pantry.new
|
10
|
+
pantry_table.hashes.each do |item|
|
11
|
+
@pantry.add(item['name'].downcase, item['quantity'])
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
When /^I eat (\d+) (\w+)$/ do |count, fruit|
|
16
|
+
@eattingMachine.eat(count)
|
17
|
+
@eattingMachine.belly_count = count.to_i
|
18
|
+
end
|
19
|
+
|
20
|
+
When /^I eat (\d+) (\w+) from the pantry$/ do |count, fruit|
|
21
|
+
@pantry.remove(fruit, count.to_i)
|
22
|
+
end
|
23
|
+
|
24
|
+
Then /^I should have (\d+) (\w+)$/ do |count, fruit|
|
25
|
+
@eattingMachine.fruit_total.should == count.to_i
|
26
|
+
end
|
27
|
+
|
28
|
+
Then /^I should have (\d+) (\w+) in my belly$/ do |count, fruit|
|
29
|
+
@eattingMachine.belly_count.should == count.to_i
|
30
|
+
end
|
31
|
+
|
32
|
+
Then /^I should have (\d+) (\w+) in the pantry$/ do |count, fruit|
|
33
|
+
@pantry.count(fruit).should == count.to_i
|
34
|
+
end
|
data/gem_tasks/fix_cr_lf.rake
CHANGED
@@ -2,7 +2,7 @@ desc 'Make all files use UNIX (\n) line endings'
|
|
2
2
|
task :fix_cr_lf do
|
3
3
|
files = FileList['**/*']
|
4
4
|
files.each do |f|
|
5
|
-
next if File.directory?(f)
|
5
|
+
next if File.directory?(f) || f =~ /dos/
|
6
6
|
s = IO.read(f)
|
7
7
|
s.gsub!(/\r?\n/, "\n")
|
8
8
|
File.open(f, "w") { |io| io.write(s) }
|
data/gem_tasks/yard.rake
ADDED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'autotest'
|
2
2
|
require 'tempfile'
|
3
|
+
require File.dirname(__FILE__) + '/../cucumber/platform'
|
3
4
|
|
4
5
|
module Autotest::CucumberMixin
|
5
6
|
def self.included(receiver)
|
@@ -121,11 +122,10 @@ module Autotest::CucumberMixin
|
|
121
122
|
else
|
122
123
|
scenario_args = scenarios_to_run.map { |s| "-s '#{s}'" }.join(' ')
|
123
124
|
end
|
124
|
-
|
125
|
-
return "#{cucumber} #{args} #{scenario_args}"
|
125
|
+
return "#{$CUCUMBER_RUBY} #{cucumber} #{args} #{scenario_args}"
|
126
126
|
end
|
127
127
|
|
128
128
|
def cucumber
|
129
|
-
File.
|
129
|
+
File.file?("script/cucumber") ? "script/cucumber" : "cucumber"
|
130
130
|
end
|
131
131
|
end
|
data/lib/cucumber/broadcaster.rb
CHANGED
@@ -11,7 +11,7 @@ module Cucumber
|
|
11
11
|
|
12
12
|
def method_missing(method_name, *args)
|
13
13
|
@receivers.each do |receiver|
|
14
|
-
r = (receiver == STDOUT) ? Kernel: receiver # Needed to make colors work on Windows
|
14
|
+
r = (receiver == STDOUT) ? Kernel : receiver # Needed to make colors work on Windows
|
15
15
|
r.__send__(method_name, *args) if receiver.respond_to?(method_name)
|
16
16
|
end
|
17
17
|
end
|