jeffrafter-cucumber 0.1.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History.txt +262 -0
- data/License.txt +20 -0
- data/Manifest.txt +241 -0
- data/README.txt +41 -0
- data/Rakefile +8 -0
- data/TODO.txt +26 -0
- data/bin/cucumber +6 -0
- data/config/hoe.rb +69 -0
- data/config/requirements.rb +15 -0
- data/cucumber.yml +1 -0
- data/examples/calculator_ruby_features/Rakefile +6 -0
- data/examples/calculator_ruby_features/features/addition.rb +23 -0
- data/examples/calculator_ruby_features/features/step_definitons/calculator_steps.rb +43 -0
- data/examples/cs/README.textile +22 -0
- data/examples/cs/Rakefile +12 -0
- data/examples/cs/features/hello.feature +11 -0
- data/examples/cs/features/step_definitons/hello_steps.rb +25 -0
- data/examples/cs/features/step_definitons/tree_steps.rb +14 -0
- data/examples/cs/features/tree.feature +9 -0
- data/examples/cs/src/Hello.cs +18 -0
- data/examples/dos_line_endings/Rakefile +6 -0
- data/examples/dos_line_endings/features/dos_line_endings.feature +9 -0
- data/examples/i18n/README.textile +18 -0
- data/examples/i18n/Rakefile +16 -0
- data/examples/i18n/ar/Rakefile +6 -0
- data/examples/i18n/ar/features/addition.feature +17 -0
- data/examples/i18n/ar/features/step_definitons/calculator_steps.rb +32 -0
- data/examples/i18n/ar/lib/calculator.rb +10 -0
- data/examples/i18n/da/Rakefile +6 -0
- data/examples/i18n/da/features/step_definitons/kalkulator_steps.rb +22 -0
- data/examples/i18n/da/features/summering.feature +17 -0
- data/examples/i18n/da/lib/kalkulator.rb +11 -0
- data/examples/i18n/de/Rakefile +6 -0
- data/examples/i18n/de/features/addition.feature +17 -0
- data/examples/i18n/de/features/division.feature +10 -0
- data/examples/i18n/de/features/step_definitons/calculator_steps.rb +30 -0
- data/examples/i18n/de/lib/calculator.rb +14 -0
- data/examples/i18n/en/Rakefile +6 -0
- data/examples/i18n/en/features/addition.feature +17 -0
- data/examples/i18n/en/features/division.feature +10 -0
- data/examples/i18n/en/features/step_definitons/calculator_steps.rb +31 -0
- data/examples/i18n/en/lib/calculator.rb +14 -0
- data/examples/i18n/es/Rakefile +6 -0
- data/examples/i18n/es/features/adicion.feature +17 -0
- data/examples/i18n/es/features/step_definitons/calculador_steps.rb +22 -0
- data/examples/i18n/es/lib/calculador.rb +11 -0
- data/examples/i18n/et/Rakefile +6 -0
- data/examples/i18n/et/features/liitmine.feature +17 -0
- data/examples/i18n/et/features/step_definitions/kalkulaator_steps.rb +26 -0
- data/examples/i18n/et/lib/kalkulaator.rb +10 -0
- data/examples/i18n/fr/Rakefile +6 -0
- data/examples/i18n/fr/features/addition.feature +13 -0
- data/examples/i18n/fr/features/step_definitions/calculatrice_steps.rb +22 -0
- data/examples/i18n/fr/lib/calculatrice.rb +10 -0
- data/examples/i18n/id/Rakefile +6 -0
- data/examples/i18n/id/features/addition.feature +17 -0
- data/examples/i18n/id/features/division.feature +10 -0
- data/examples/i18n/id/features/step_definitons/calculator_steps.rb +31 -0
- data/examples/i18n/id/lib/calculator.rb +14 -0
- data/examples/i18n/it/Rakefile +6 -0
- data/examples/i18n/it/features/somma.feature +10 -0
- data/examples/i18n/it/features/step_definitons/calcolatrice_steps.rb +22 -0
- data/examples/i18n/it/lib/calcolatrice.rb +11 -0
- data/examples/i18n/ja/README.txt +5 -0
- data/examples/i18n/ja/Rakefile +6 -0
- data/examples/i18n/ja/features/addition.feature +17 -0
- data/examples/i18n/ja/features/division.feature +10 -0
- data/examples/i18n/ja/features/step_definitons/calculator_steps.rb +30 -0
- data/examples/i18n/ja/lib/calculator.rb +14 -0
- data/examples/i18n/lt/Rakefile +6 -0
- data/examples/i18n/lt/features/addition.feature +17 -0
- data/examples/i18n/lt/features/division.feature +10 -0
- data/examples/i18n/lt/features/step_definitons/calculator_steps.rb +31 -0
- data/examples/i18n/lt/lib/calculator.rb +14 -0
- data/examples/i18n/no/Rakefile +6 -0
- data/examples/i18n/no/features/step_definitons/kalkulator_steps.rb +22 -0
- data/examples/i18n/no/features/summering.feature +17 -0
- data/examples/i18n/no/lib/kalkulator.rb +11 -0
- data/examples/i18n/pt/Rakefile +6 -0
- data/examples/i18n/pt/features/adicao.feature +10 -0
- data/examples/i18n/pt/features/step_definitions/calculadora_steps.rb +22 -0
- data/examples/i18n/pt/lib/calculadora.rb +10 -0
- data/examples/i18n/ro/Rakefile +6 -0
- data/examples/i18n/ro/features/step_definitons/calculator_steps.rb +22 -0
- data/examples/i18n/ro/features/suma.feature +10 -0
- data/examples/i18n/ro/lib/calculator.rb +11 -0
- data/examples/i18n/se/Rakefile +6 -0
- data/examples/i18n/se/features/step_definitons/kalkulator_steps.rb +22 -0
- data/examples/i18n/se/features/summering.feature +17 -0
- data/examples/i18n/se/lib/kalkulator.rb +11 -0
- data/examples/i18n/zh-CN/Rakefile +6 -0
- data/examples/i18n/zh-CN/features/addition.feature +17 -0
- data/examples/i18n/zh-CN/features/step_definitons/calculator_steps.rb +24 -0
- data/examples/i18n/zh-CN/lib/calculator.rb +10 -0
- data/examples/java/README.textile +22 -0
- data/examples/java/Rakefile +12 -0
- data/examples/java/features/hello.feature +11 -0
- data/examples/java/features/step_definitons/hello_steps.rb +25 -0
- data/examples/java/features/step_definitons/tree_steps.rb +14 -0
- data/examples/java/features/tree.feature +9 -0
- data/examples/java/src/cucumber/demo/Hello.java +16 -0
- data/examples/selenium/Rakefile +6 -0
- data/examples/selenium/features/search.feature +9 -0
- data/examples/selenium/features/step_definitons/stories_steps.rb +41 -0
- data/examples/test_unit/Rakefile +6 -0
- data/examples/test_unit/features/step_definitions/test_unit_steps.rb +26 -0
- data/examples/test_unit/features/test_unit.feature +9 -0
- data/examples/tickets/Rakefile +11 -0
- data/examples/tickets/cucumber.yml +2 -0
- data/examples/tickets/features/step_definitons/tickets_steps.rb +32 -0
- data/examples/tickets/features/tickets.feature +24 -0
- data/examples/watir/Rakefile +6 -0
- data/examples/watir/features/search.feature +9 -0
- data/examples/watir/features/step_definitons/stories_steps.rb +51 -0
- data/features/see_features.feature +8 -0
- data/features/steps/features_steps.rb +9 -0
- data/gem_tasks/deployment.rake +34 -0
- data/gem_tasks/environment.rake +7 -0
- data/gem_tasks/features.rake +6 -0
- data/gem_tasks/fix_cr_lf.rake +10 -0
- data/gem_tasks/flog.rake +4 -0
- data/gem_tasks/gemspec.rake +6 -0
- data/gem_tasks/rspec.rake +35 -0
- data/gem_tasks/treetop.rake +41 -0
- data/lib/autotest/cucumber.rb +6 -0
- data/lib/autotest/cucumber_mixin.rb +109 -0
- data/lib/autotest/cucumber_rails.rb +6 -0
- data/lib/autotest/cucumber_rails_rspec.rb +6 -0
- data/lib/autotest/cucumber_rspec.rb +6 -0
- data/lib/autotest/discover.rb +9 -0
- data/lib/cucumber/broadcaster.rb +20 -0
- data/lib/cucumber/cli.rb +303 -0
- data/lib/cucumber/core_ext/proc.rb +69 -0
- data/lib/cucumber/core_ext/string.rb +28 -0
- data/lib/cucumber/executor.rb +190 -0
- data/lib/cucumber/formatters/ansicolor.rb +109 -0
- data/lib/cucumber/formatters/autotest_formatter.rb +23 -0
- data/lib/cucumber/formatters/cucumber.css +132 -0
- data/lib/cucumber/formatters/cucumber.js +11 -0
- data/lib/cucumber/formatters/html_formatter.rb +128 -0
- data/lib/cucumber/formatters/jquery.js +32 -0
- data/lib/cucumber/formatters/pretty_formatter.rb +234 -0
- data/lib/cucumber/formatters/profile_formatter.rb +92 -0
- data/lib/cucumber/formatters/progress_formatter.rb +58 -0
- data/lib/cucumber/formatters.rb +1 -0
- data/lib/cucumber/languages.yml +258 -0
- data/lib/cucumber/model/table.rb +28 -0
- data/lib/cucumber/model.rb +1 -0
- data/lib/cucumber/platform.rb +12 -0
- data/lib/cucumber/rails/rspec.rb +12 -0
- data/lib/cucumber/rails/world.rb +73 -0
- data/lib/cucumber/rake/task.rb +101 -0
- data/lib/cucumber/step_methods.rb +49 -0
- data/lib/cucumber/step_mother.rb +95 -0
- data/lib/cucumber/tree/feature.rb +63 -0
- data/lib/cucumber/tree/features.rb +21 -0
- data/lib/cucumber/tree/given_scenario.rb +13 -0
- data/lib/cucumber/tree/scenario.rb +174 -0
- data/lib/cucumber/tree/step.rb +134 -0
- data/lib/cucumber/tree/table.rb +26 -0
- data/lib/cucumber/tree/top_down_visitor.rb +23 -0
- data/lib/cucumber/tree.rb +18 -0
- data/lib/cucumber/treetop_parser/feature.treetop.erb +206 -0
- data/lib/cucumber/treetop_parser/feature_ar.rb +1591 -0
- data/lib/cucumber/treetop_parser/feature_cy.rb +1591 -0
- data/lib/cucumber/treetop_parser/feature_da.rb +1591 -0
- data/lib/cucumber/treetop_parser/feature_de.rb +1591 -0
- data/lib/cucumber/treetop_parser/feature_en-tx.rb +1591 -0
- data/lib/cucumber/treetop_parser/feature_en.rb +1591 -0
- data/lib/cucumber/treetop_parser/feature_es.rb +1591 -0
- data/lib/cucumber/treetop_parser/feature_et.rb +1591 -0
- data/lib/cucumber/treetop_parser/feature_fr.rb +1591 -0
- data/lib/cucumber/treetop_parser/feature_id.rb +1591 -0
- data/lib/cucumber/treetop_parser/feature_it.rb +1591 -0
- data/lib/cucumber/treetop_parser/feature_ja.rb +1591 -0
- data/lib/cucumber/treetop_parser/feature_lt.rb +1591 -0
- data/lib/cucumber/treetop_parser/feature_nl.rb +1591 -0
- data/lib/cucumber/treetop_parser/feature_no.rb +1591 -0
- data/lib/cucumber/treetop_parser/feature_parser.rb +34 -0
- data/lib/cucumber/treetop_parser/feature_pl.rb +1591 -0
- data/lib/cucumber/treetop_parser/feature_pt.rb +1591 -0
- data/lib/cucumber/treetop_parser/feature_ro.rb +1591 -0
- data/lib/cucumber/treetop_parser/feature_ro2.rb +1591 -0
- data/lib/cucumber/treetop_parser/feature_ru.rb +1591 -0
- data/lib/cucumber/treetop_parser/feature_se.rb +1591 -0
- data/lib/cucumber/treetop_parser/feature_zh-CN.rb +1591 -0
- data/lib/cucumber/version.rb +9 -0
- data/lib/cucumber.rb +38 -0
- data/rails_generators/cucumber/USAGE +11 -0
- data/rails_generators/cucumber/cucumber_generator.rb +30 -0
- data/rails_generators/cucumber/templates/cucumber +7 -0
- data/rails_generators/cucumber/templates/cucumber.rake +7 -0
- data/rails_generators/cucumber/templates/env.rb +8 -0
- data/rails_generators/cucumber/templates/webrat_steps.rb +95 -0
- data/rails_generators/feature/USAGE +12 -0
- data/rails_generators/feature/feature_generator.rb +16 -0
- data/rails_generators/feature/templates/feature.erb +28 -0
- data/rails_generators/feature/templates/steps.erb +22 -0
- data/script/console +10 -0
- data/script/console.cmd +1 -0
- data/script/destroy +14 -0
- data/script/destroy.cmd +1 -0
- data/script/generate +14 -0
- data/script/generate.cmd +1 -0
- data/script/txt2html +74 -0
- data/script/txt2html.cmd +1 -0
- data/setup.rb +1585 -0
- data/spec/cucumber/broadcaster_spec.rb +27 -0
- data/spec/cucumber/cli_spec.rb +412 -0
- data/spec/cucumber/core_ext/proc_spec.rb +45 -0
- data/spec/cucumber/core_ext/string_spec.rb +34 -0
- data/spec/cucumber/executor_spec.rb +298 -0
- data/spec/cucumber/formatters/ansicolor_spec.rb +35 -0
- data/spec/cucumber/formatters/autotest_formatter_spec.rb +26 -0
- data/spec/cucumber/formatters/features.html +269 -0
- data/spec/cucumber/formatters/html_formatter_spec.rb +74 -0
- data/spec/cucumber/formatters/pretty_formatter_spec.rb +204 -0
- data/spec/cucumber/formatters/profile_formatter_spec.rb +192 -0
- data/spec/cucumber/formatters/progress_formatter_spec.rb +65 -0
- data/spec/cucumber/model/table_spec.rb +20 -0
- data/spec/cucumber/rails/stubs/mini_rails.rb +17 -0
- data/spec/cucumber/rails/stubs/test_help.rb +1 -0
- data/spec/cucumber/rails/world_spec.rb +11 -0
- data/spec/cucumber/sell_cucumbers.feature +19 -0
- data/spec/cucumber/step_mother_spec.rb +74 -0
- data/spec/cucumber/tree/feature_spec.rb +43 -0
- data/spec/cucumber/tree/row_scenario_spec.rb +55 -0
- data/spec/cucumber/tree/scenario_spec.rb +76 -0
- data/spec/cucumber/tree/step_spec.rb +50 -0
- data/spec/cucumber/treetop_parser/empty_feature.feature +4 -0
- data/spec/cucumber/treetop_parser/empty_scenario.feature +9 -0
- data/spec/cucumber/treetop_parser/feature_parser_spec.rb +98 -0
- data/spec/cucumber/treetop_parser/fit_scenario.feature +8 -0
- data/spec/cucumber/treetop_parser/given_scenario.feature +9 -0
- data/spec/cucumber/treetop_parser/multiline_steps.feature +17 -0
- data/spec/cucumber/treetop_parser/multiple_tables.feature +29 -0
- data/spec/cucumber/treetop_parser/spaces.feature +10 -0
- data/spec/cucumber/treetop_parser/test_dos.feature +25 -0
- data/spec/cucumber/treetop_parser/with_comments.feature +10 -0
- data/spec/spec.opts +2 -0
- data/spec/spec_helper.rb +20 -0
- metadata +335 -0
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
# http://www.ietf.org/rfc/rfc4646.txt
|
|
2
|
+
# http://www.ietf.org/rfc/rfc4647.txt
|
|
3
|
+
# Others:
|
|
4
|
+
# http://en.wikipedia.org/wiki/IETF_language_tag
|
|
5
|
+
# http://www.iana.org/assignments/language-subtag-registry
|
|
6
|
+
# http://ftp.ics.uci.edu/pub/ietf/http/related/iso639.txt (Use this I think)
|
|
7
|
+
"en":
|
|
8
|
+
feature: Feature
|
|
9
|
+
scenario: Scenario
|
|
10
|
+
more_examples: More Examples
|
|
11
|
+
given_scenario: GivenScenario
|
|
12
|
+
given: Given
|
|
13
|
+
when: When
|
|
14
|
+
then: Then
|
|
15
|
+
and: And
|
|
16
|
+
but: But
|
|
17
|
+
# Please help us keeping the languages below uptodate. The parsers for a language
|
|
18
|
+
# that is missing a keyword will expect the English word until the missing word(s)
|
|
19
|
+
# are added.
|
|
20
|
+
#
|
|
21
|
+
# Please keep the grammars in alphabetical order from here and down.
|
|
22
|
+
|
|
23
|
+
# Arabic
|
|
24
|
+
"ar":
|
|
25
|
+
feature: خاصية
|
|
26
|
+
scenario: سيناريو
|
|
27
|
+
more_examples: امثلة اكثر
|
|
28
|
+
given_scenario: بفرض سيناريو معين
|
|
29
|
+
given: بفرض
|
|
30
|
+
when: متى
|
|
31
|
+
then: اذاً
|
|
32
|
+
and: و
|
|
33
|
+
but: لكن
|
|
34
|
+
# Welsh
|
|
35
|
+
"cy":
|
|
36
|
+
feature: Arwedd
|
|
37
|
+
scenario: Scenario
|
|
38
|
+
more_examples: Hychwaneg enghreifftiau
|
|
39
|
+
given_scenario: Anrhegedig scenario
|
|
40
|
+
given: anrhegedig a
|
|
41
|
+
when: Pryd
|
|
42
|
+
then: Yna
|
|
43
|
+
and: A
|
|
44
|
+
but: Ond
|
|
45
|
+
# Danish
|
|
46
|
+
"da":
|
|
47
|
+
feature: Egenskab
|
|
48
|
+
scenario: Scenarie
|
|
49
|
+
given_scenario: GivetScenarie
|
|
50
|
+
given: Givet
|
|
51
|
+
when: Når
|
|
52
|
+
then: Så
|
|
53
|
+
and: Og
|
|
54
|
+
but: Men
|
|
55
|
+
# German
|
|
56
|
+
"de":
|
|
57
|
+
feature: Funktionalität
|
|
58
|
+
scenario: Szenario
|
|
59
|
+
more_examples: Mehr Beispiele
|
|
60
|
+
given_scenario: Gegebenes Szenario
|
|
61
|
+
given: Gegeben sei
|
|
62
|
+
when: Wenn
|
|
63
|
+
then: Dann
|
|
64
|
+
and: Und
|
|
65
|
+
but: Aber
|
|
66
|
+
# LOLCAT
|
|
67
|
+
"en-lol":
|
|
68
|
+
feature: OH HAI
|
|
69
|
+
scenario: MISHUN
|
|
70
|
+
more_examples: MOAR EXAMPLZ
|
|
71
|
+
given_scenario: SRSLY
|
|
72
|
+
given: GIVN
|
|
73
|
+
when: WEN
|
|
74
|
+
then: DEN
|
|
75
|
+
and: AN
|
|
76
|
+
but: BUT
|
|
77
|
+
# Texan
|
|
78
|
+
"en-tx":
|
|
79
|
+
feature: Feature
|
|
80
|
+
scenario: Scenario
|
|
81
|
+
more_examples: More Examples
|
|
82
|
+
given_scenario: GivenScenario
|
|
83
|
+
given: Given y'all
|
|
84
|
+
when: When y'all
|
|
85
|
+
then: Then y'all
|
|
86
|
+
and: And y'all
|
|
87
|
+
but: But y'all
|
|
88
|
+
# Spanish
|
|
89
|
+
"es":
|
|
90
|
+
feature: Característica
|
|
91
|
+
scenario: Escenario
|
|
92
|
+
more_examples: Más ejemplos
|
|
93
|
+
given_scenario: DadoElEscenario
|
|
94
|
+
given: Dado
|
|
95
|
+
when: Cuando
|
|
96
|
+
then: Entonces
|
|
97
|
+
and: Y
|
|
98
|
+
but: Pero
|
|
99
|
+
# Estonian
|
|
100
|
+
"et":
|
|
101
|
+
feature: Omadus
|
|
102
|
+
scenario: Stsenaarium
|
|
103
|
+
given_scenario: EeldadesStsenaariumit
|
|
104
|
+
given: Eeldades
|
|
105
|
+
when: Kui
|
|
106
|
+
then: Siis
|
|
107
|
+
and: Ja
|
|
108
|
+
but: Kuid
|
|
109
|
+
# French
|
|
110
|
+
"fr":
|
|
111
|
+
feature: Fonction
|
|
112
|
+
scenario: Scenario
|
|
113
|
+
more_examples: Plus d'exemples
|
|
114
|
+
given_scenario: SoitScenario
|
|
115
|
+
given: Soit
|
|
116
|
+
when: Lorsque
|
|
117
|
+
then: Alors
|
|
118
|
+
and: Et
|
|
119
|
+
but: Mais
|
|
120
|
+
# Malay
|
|
121
|
+
"id":
|
|
122
|
+
feature: Fitur
|
|
123
|
+
scenario: Skenario
|
|
124
|
+
more_examples: Contoh Tambahan
|
|
125
|
+
given_scenario: DenganSkenario
|
|
126
|
+
given: Dengan
|
|
127
|
+
when: Ketika
|
|
128
|
+
then: Maka
|
|
129
|
+
and: Dan
|
|
130
|
+
but: Tapi
|
|
131
|
+
# Italian
|
|
132
|
+
"it":
|
|
133
|
+
feature: Funzionalità
|
|
134
|
+
scenario: Scenario
|
|
135
|
+
more_examples: Più esempi
|
|
136
|
+
given_scenario: DatoLoScenario
|
|
137
|
+
given: Dato
|
|
138
|
+
when: Quando
|
|
139
|
+
then: Allora
|
|
140
|
+
and: E
|
|
141
|
+
but: Ma
|
|
142
|
+
# Japanese
|
|
143
|
+
"ja":
|
|
144
|
+
feature: フィーチャ
|
|
145
|
+
scenario: シナリオ
|
|
146
|
+
more_examples: 他のサンプル
|
|
147
|
+
given_scenario: 前提シナリオ
|
|
148
|
+
given: 前提
|
|
149
|
+
when: もし
|
|
150
|
+
then: ならば
|
|
151
|
+
and: かつ
|
|
152
|
+
but: しかし
|
|
153
|
+
# Lithuanian
|
|
154
|
+
"lt":
|
|
155
|
+
feature: Sąvybė
|
|
156
|
+
scenario: Scenarijus
|
|
157
|
+
more_examples: Daugiau pavyzdžių
|
|
158
|
+
given_scenario: DuotasScenarijus
|
|
159
|
+
given: Duota
|
|
160
|
+
when: Kai
|
|
161
|
+
then: Tada
|
|
162
|
+
and: Ir
|
|
163
|
+
but: Bet
|
|
164
|
+
# Dutch
|
|
165
|
+
"nl":
|
|
166
|
+
feature: Functionaliteit
|
|
167
|
+
scenario: Scenario
|
|
168
|
+
more_examples: Meer voorbeelden
|
|
169
|
+
given_scenario: GegevenScenario
|
|
170
|
+
given: Gegeven
|
|
171
|
+
when: Als
|
|
172
|
+
then: Dan
|
|
173
|
+
and: En
|
|
174
|
+
but: Maar
|
|
175
|
+
# Norwegian
|
|
176
|
+
"no":
|
|
177
|
+
feature: Egenskap
|
|
178
|
+
scenario: Scenario
|
|
179
|
+
more_examples: Flere eksempler
|
|
180
|
+
given_scenario: GittScenario
|
|
181
|
+
given: Gitt
|
|
182
|
+
when: Når
|
|
183
|
+
then: Så
|
|
184
|
+
and: Og
|
|
185
|
+
but: Men
|
|
186
|
+
# Polish
|
|
187
|
+
"pl":
|
|
188
|
+
feature: Właściwość
|
|
189
|
+
scenario: Scenariusz
|
|
190
|
+
more_examples: WięcejPrzykładów
|
|
191
|
+
given_scenario: DanyScenariusz
|
|
192
|
+
given: Dane
|
|
193
|
+
when: Jeżeli
|
|
194
|
+
then: Wtedy
|
|
195
|
+
and: Oraz
|
|
196
|
+
but: Ale
|
|
197
|
+
# Portuguese
|
|
198
|
+
"pt":
|
|
199
|
+
feature: Característica
|
|
200
|
+
scenario: Cenário
|
|
201
|
+
given_scenario: DadoOCenário
|
|
202
|
+
given: Dado
|
|
203
|
+
when: Quando
|
|
204
|
+
then: Então
|
|
205
|
+
and: E
|
|
206
|
+
but: Mas
|
|
207
|
+
# Romanian (without diacritics - the commonly used)
|
|
208
|
+
"ro":
|
|
209
|
+
feature: Functionalitate
|
|
210
|
+
scenario: Scenariu
|
|
211
|
+
more_examples: Mai multe exemple
|
|
212
|
+
given_scenario: ScenariuDat
|
|
213
|
+
given: Daca
|
|
214
|
+
when: Cand
|
|
215
|
+
then: Atunci
|
|
216
|
+
and: Si
|
|
217
|
+
but: Dar
|
|
218
|
+
# Romanian (with diacritics - not commonly used)
|
|
219
|
+
"ro2":
|
|
220
|
+
feature: Funcționalitate
|
|
221
|
+
scenario: Scenariu
|
|
222
|
+
more_examples: Mai multe exemple
|
|
223
|
+
given_scenario: ScenariuDat
|
|
224
|
+
given: Dacă
|
|
225
|
+
when: Când
|
|
226
|
+
then: Atunci
|
|
227
|
+
and: Și
|
|
228
|
+
but: Dar
|
|
229
|
+
# Russian
|
|
230
|
+
"ru":
|
|
231
|
+
feature: Функционал
|
|
232
|
+
scenario: Сценарий
|
|
233
|
+
given_scenario: ДанныйСценарий
|
|
234
|
+
given: Сначала
|
|
235
|
+
when: Если
|
|
236
|
+
then: То
|
|
237
|
+
and: И
|
|
238
|
+
but: Но
|
|
239
|
+
# Swedish
|
|
240
|
+
"se":
|
|
241
|
+
feature: Egenskap
|
|
242
|
+
scenario: Scenario
|
|
243
|
+
given_scenario: GivetScenario
|
|
244
|
+
given: Givet
|
|
245
|
+
when: När
|
|
246
|
+
then: Så
|
|
247
|
+
and: Och
|
|
248
|
+
but: Men
|
|
249
|
+
# Chinese simplified
|
|
250
|
+
"zh-CN":
|
|
251
|
+
feature: 功能
|
|
252
|
+
scenario: 场景
|
|
253
|
+
given_scenario: 引用场景
|
|
254
|
+
given: 假如
|
|
255
|
+
when: 当
|
|
256
|
+
then: 那么
|
|
257
|
+
and: 而且
|
|
258
|
+
but: 但是
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
module Cucumber
|
|
2
|
+
module Model
|
|
3
|
+
class Table
|
|
4
|
+
attr_accessor :raw
|
|
5
|
+
|
|
6
|
+
# Creates a new table. The +raw+ argument should be an array
|
|
7
|
+
# of arrays
|
|
8
|
+
def initialize(raw)
|
|
9
|
+
@raw = raw
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
# Turn the table into an array of Hash where each Hash
|
|
13
|
+
# has keys corresponding to the table header (first line)
|
|
14
|
+
# and the values are the individual row cells.
|
|
15
|
+
def hashes
|
|
16
|
+
header = @raw[0]
|
|
17
|
+
@raw[1..-1].map do |row|
|
|
18
|
+
h = {}
|
|
19
|
+
row.each_with_index do |v,n|
|
|
20
|
+
key = header[n]
|
|
21
|
+
h[key] = v
|
|
22
|
+
end
|
|
23
|
+
h
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
%w{table}.each{|f| require "cucumber/model/#{f}"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Detect the platform we're running on so we can tweak behaviour
|
|
2
|
+
# in various places.
|
|
3
|
+
require 'rbconfig'
|
|
4
|
+
|
|
5
|
+
$CUCUMBER_JRUBY = defined?(JRUBY_VERSION)
|
|
6
|
+
$CUCUMBER_IRONRUBY = Config::CONFIG['sitedir'] =~ /IronRuby/
|
|
7
|
+
$CUCUMBER_WINDOWS = Config::CONFIG['host_os'] =~ /mswin|mingw/
|
|
8
|
+
$CUCUMBER_WINDOWS_MRI = $CUCUMBER_WINDOWS && !$CUCUMBER_JRUBY && !$CUCUMBER_IRONRUBY
|
|
9
|
+
|
|
10
|
+
if $CUCUMBER_IRONRUBY
|
|
11
|
+
ENV['GEM_PATH'] ||= "C:/ruby/lib/ruby/gems/1.8"
|
|
12
|
+
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
require 'spec'
|
|
2
|
+
require 'spec/rails'
|
|
3
|
+
|
|
4
|
+
# Hack to stop RSpec from dumping the summary
|
|
5
|
+
Spec::Runner::Options.class_eval do
|
|
6
|
+
def examples_should_be_run?
|
|
7
|
+
false
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
ActionController::Integration::Session.send(:include, Spec::Matchers)
|
|
12
|
+
ActionController::Integration::Session.send(:include, Spec::Rails::Matchers)
|
|
@@ -0,0 +1,73 @@
|
|
|
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
|
|
15
|
+
perform_action_without_rescue
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
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
|
+
$main = 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
|
+
$main.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
|
+
$main.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
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
module Cucumber
|
|
2
|
+
module Rake
|
|
3
|
+
# Defines a task for running features.
|
|
4
|
+
class Task
|
|
5
|
+
LIB = File.expand_path(File.dirname(__FILE__) + '/../..')
|
|
6
|
+
|
|
7
|
+
attr_accessor :libs
|
|
8
|
+
attr_accessor :binary
|
|
9
|
+
attr_accessor :step_list
|
|
10
|
+
attr_accessor :step_pattern
|
|
11
|
+
attr_accessor :feature_list
|
|
12
|
+
attr_accessor :feature_pattern
|
|
13
|
+
attr_accessor :cucumber_opts
|
|
14
|
+
attr_accessor :rcov
|
|
15
|
+
attr_accessor :rcov_opts
|
|
16
|
+
|
|
17
|
+
# Define a task
|
|
18
|
+
def initialize(task_name = "features", desc = "Run Features with Cucumber")
|
|
19
|
+
@task_name, @desc = task_name, desc
|
|
20
|
+
@libs = []
|
|
21
|
+
@rcov_opts = %w{--rails --exclude osx\/objc,gems\/}
|
|
22
|
+
|
|
23
|
+
yield self if block_given?
|
|
24
|
+
|
|
25
|
+
@feature_pattern = "features/**/*.feature" if feature_pattern.nil? && feature_list.nil?
|
|
26
|
+
@step_pattern = "features/**/*.rb" if step_pattern.nil? && step_list.nil?
|
|
27
|
+
@binary ||= File.expand_path(File.dirname(__FILE__) + '/../../../bin/cucumber')
|
|
28
|
+
define_task
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def define_task
|
|
32
|
+
desc @desc
|
|
33
|
+
task @task_name do
|
|
34
|
+
ruby(arguments_for_ruby_execution.join(" ")) # ruby(*args) is broken on Windows
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def arguments_for_ruby_execution(task_args = nil)
|
|
39
|
+
lib_args = ['"%s"' % ([LIB] + libs).join(File::PATH_SEPARATOR)]
|
|
40
|
+
cucumber_bin = ['"%s"' % binary]
|
|
41
|
+
cuc_opts = [(ENV['CUCUMBER_OPTS'] || cucumber_opts)]
|
|
42
|
+
|
|
43
|
+
step_files(task_args).each do |step_file|
|
|
44
|
+
cuc_opts << '--require'
|
|
45
|
+
cuc_opts << step_file
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
if rcov
|
|
49
|
+
args = (['-I'] + lib_args + ['-S', 'rcov'] + rcov_opts +
|
|
50
|
+
cucumber_bin + ['--'] + cuc_opts + feature_files(task_args)).flatten
|
|
51
|
+
else
|
|
52
|
+
args = (['-I'] + lib_args + cucumber_bin + cuc_opts + feature_files(task_args)).flatten
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
args
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def feature_files(task_args = nil) # :nodoc:
|
|
59
|
+
if ENV['FEATURE']
|
|
60
|
+
FileList[ ENV['FEATURE'] ]
|
|
61
|
+
else
|
|
62
|
+
result = []
|
|
63
|
+
result += feature_list.to_a if feature_list
|
|
64
|
+
result += FileList[feature_pattern].to_a if feature_pattern
|
|
65
|
+
FileList[result]
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
def step_files(task_args = nil) # :nodoc:
|
|
70
|
+
if ENV['STEPS']
|
|
71
|
+
FileList[ ENV['STEPS'] ]
|
|
72
|
+
else
|
|
73
|
+
result = []
|
|
74
|
+
result += Array(step_list) if step_list
|
|
75
|
+
result += Array(FileList[step_pattern]) if step_pattern
|
|
76
|
+
FileList[result]
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
class FeatureTask < Task
|
|
82
|
+
|
|
83
|
+
def initialize(task_name = "feature", desc = "Run a specified feature with Cucumber. #{task_name}[feature_name]")
|
|
84
|
+
super(task_name, desc)
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
def define_task
|
|
88
|
+
desc @desc
|
|
89
|
+
task @task_name, :feature_name do |t, args|
|
|
90
|
+
ruby(arguments_for_ruby_execution(args).join(" ")) # ruby(*args) is broken on Windows
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
def feature_files(task_arguments) # :nodoc:
|
|
95
|
+
FileList[File.join("features", "**", "#{task_arguments[:feature_name]}.feature")]
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
end
|
|
101
|
+
end
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
require 'cucumber/step_mother'
|
|
2
|
+
|
|
3
|
+
module Cucumber
|
|
4
|
+
# Defines "global" methods that may be used in *_steps.rb files.
|
|
5
|
+
module StepMethods
|
|
6
|
+
# Each scenario will execute in the context of what the supplied block returns.
|
|
7
|
+
def World(&proc)
|
|
8
|
+
executor.register_world_proc(&proc)
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def Before(&proc)
|
|
12
|
+
executor.register_before_scenario_proc(&proc)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def After(&proc)
|
|
16
|
+
executor.register_after_scenario_proc(&proc)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def AfterStep(&proc)
|
|
20
|
+
executor.register_after_step_proc(&proc)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def Given(key, &proc)
|
|
24
|
+
step_mother.register_step_proc(key, &proc)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def When(key, &proc)
|
|
28
|
+
step_mother.register_step_proc(key, &proc)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def Then(key, &proc)
|
|
32
|
+
step_mother.register_step_proc(key, &proc)
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
# Simple workaround for old skool steps
|
|
36
|
+
def steps_for(*_)
|
|
37
|
+
STDERR.puts "WARNING: In Cucumber the steps_for method is obsolete"
|
|
38
|
+
yield
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def step_mother #:nodoc:
|
|
42
|
+
@step_mother ||= StepMother.new
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def executor
|
|
46
|
+
@executor ||= Executor.new(step_mother)
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
require 'cucumber/tree/top_down_visitor'
|
|
2
|
+
require 'cucumber/core_ext/proc'
|
|
3
|
+
|
|
4
|
+
module Cucumber
|
|
5
|
+
class Pending < StandardError
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
class Duplicate < StandardError
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
class Multiple < StandardError
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
class MissingProc < StandardError
|
|
15
|
+
def message
|
|
16
|
+
"Step definitions must always have a proc"
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
class StepMother
|
|
21
|
+
PENDING = lambda do |*_|
|
|
22
|
+
raise Pending
|
|
23
|
+
end
|
|
24
|
+
PENDING.extend(CoreExt::CallIn)
|
|
25
|
+
PENDING.name = "PENDING"
|
|
26
|
+
|
|
27
|
+
def initialize
|
|
28
|
+
@step_procs = Hash.new(PENDING)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def register_step_proc(key, &proc)
|
|
32
|
+
raise MissingProc if proc.nil?
|
|
33
|
+
regexp = case(key)
|
|
34
|
+
when String
|
|
35
|
+
# Replace the $foo and $bar style parameters
|
|
36
|
+
pattern = key.gsub(/\$\w+/, '(.*)')
|
|
37
|
+
Regexp.new("^#{pattern}$")
|
|
38
|
+
when Regexp
|
|
39
|
+
key
|
|
40
|
+
else
|
|
41
|
+
raise "Step patterns must be Regexp or String, but was: #{key.inspect}"
|
|
42
|
+
end
|
|
43
|
+
proc.extend(CoreExt::CallIn)
|
|
44
|
+
proc.name = key.inspect
|
|
45
|
+
|
|
46
|
+
if @step_procs.has_key?(regexp)
|
|
47
|
+
first_proc = @step_procs[regexp]
|
|
48
|
+
message = %{Duplicate step definitions:
|
|
49
|
+
|
|
50
|
+
#{first_proc.to_backtrace_line}
|
|
51
|
+
#{proc.to_backtrace_line}
|
|
52
|
+
|
|
53
|
+
}
|
|
54
|
+
raise Duplicate.new(message)
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
@step_procs[regexp] = proc
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
def regexp_args_proc(step_name)
|
|
61
|
+
candidates = @step_procs.map do |regexp, proc|
|
|
62
|
+
if step_name =~ regexp
|
|
63
|
+
[regexp, $~.captures, proc]
|
|
64
|
+
end
|
|
65
|
+
end.compact
|
|
66
|
+
|
|
67
|
+
case(candidates.length)
|
|
68
|
+
when 0
|
|
69
|
+
[nil, [], PENDING]
|
|
70
|
+
when 1
|
|
71
|
+
candidates[0]
|
|
72
|
+
else
|
|
73
|
+
message = %{Multiple step definitions match #{step_name.inspect}:
|
|
74
|
+
|
|
75
|
+
#{candidates.map{|regexp, args, proc| proc.to_backtrace_line}.join("\n")}
|
|
76
|
+
|
|
77
|
+
}
|
|
78
|
+
raise Multiple.new(message)
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
def proc_for(regexp)
|
|
83
|
+
@step_procs[regexp]
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
def has_step_definition?(step_name)
|
|
87
|
+
_, _, proc = regexp_args_proc(step_name)
|
|
88
|
+
proc != PENDING
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
# TODO - move execute here?
|
|
92
|
+
def execute(step)
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
end
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
module Cucumber
|
|
2
|
+
module Tree
|
|
3
|
+
class Feature
|
|
4
|
+
attr_reader :header
|
|
5
|
+
attr_reader :scenarios
|
|
6
|
+
MIN_PADDING = 2
|
|
7
|
+
|
|
8
|
+
attr_accessor :file
|
|
9
|
+
|
|
10
|
+
def initialize(header, &proc)
|
|
11
|
+
@header = header
|
|
12
|
+
@scenarios = []
|
|
13
|
+
instance_eval(&proc) if block_given?
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def add_scenario(name, line, &proc)
|
|
17
|
+
scenario = Scenario.new(self, name, line, &proc)
|
|
18
|
+
@scenarios << scenario
|
|
19
|
+
scenario
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def add_row_scenario(template_scenario, values, line)
|
|
23
|
+
scenario = RowScenario.new(self, template_scenario, values, line)
|
|
24
|
+
@scenarios << scenario
|
|
25
|
+
scenario
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def scenario_named(name)
|
|
29
|
+
@scenarios.find {|s| s.name == name}
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def padding_length
|
|
33
|
+
MIN_PADDING
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def Scenario(name, &proc)
|
|
37
|
+
line = caller[0] =~ /:(\d+)$/ ? $1 : nil
|
|
38
|
+
add_scenario(name, line, &proc)
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def Table(matrix = [], &proc)
|
|
42
|
+
table = Table.new(matrix)
|
|
43
|
+
proc.call(table)
|
|
44
|
+
template_scenario = @scenarios.last
|
|
45
|
+
template_scenario.table_header = matrix[0]
|
|
46
|
+
matrix[1..-1].each do |row|
|
|
47
|
+
add_row_scenario(template_scenario, row, row.line)
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def accept(visitor)
|
|
52
|
+
visitor.visit_header(@header)
|
|
53
|
+
@scenarios.each do |scenario|
|
|
54
|
+
if scenario.row?
|
|
55
|
+
visitor.visit_row_scenario(scenario)
|
|
56
|
+
else
|
|
57
|
+
visitor.visit_regular_scenario(scenario)
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
end
|