kosmas58-cucumber 0.1.16.6 → 0.1.99.21

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.
Files changed (248) hide show
  1. data/History.txt +126 -2
  2. data/License.txt +1 -1
  3. data/Manifest.txt +0 -270
  4. data/Rakefile +1 -1
  5. data/bin/cucumber +2 -2
  6. data/config/hoe.rb +7 -2
  7. data/examples/cs/features/step_definitons/calculator_steps.rb +1 -1
  8. data/examples/i18n/README.textile +1 -1
  9. data/examples/i18n/Rakefile +3 -3
  10. data/examples/i18n/ar/features/step_definitons/calculator_steps.rb +1 -6
  11. data/examples/i18n/da/features/step_definitons/kalkulator_steps.rb +1 -1
  12. data/examples/i18n/de/features/addition.feature +6 -6
  13. data/examples/i18n/de/features/step_definitons/calculator_steps.rb +2 -2
  14. data/examples/i18n/en/features/addition.feature +6 -6
  15. data/examples/i18n/en/features/step_definitons/calculator_steps.rb +2 -2
  16. data/examples/i18n/es/features/adicion.feature +11 -12
  17. data/examples/i18n/es/features/step_definitons/calculador_steps.rb +7 -10
  18. data/examples/i18n/es/lib/calculador.rb +4 -1
  19. data/examples/i18n/et/features/liitmine.feature +7 -6
  20. data/examples/i18n/et/features/step_definitions/kalkulaator_steps.rb +1 -1
  21. data/examples/i18n/fi/features/step_definitons/laskin_steps.rb +1 -1
  22. data/examples/i18n/fi/features/yhteenlasku.feature +2 -2
  23. data/examples/i18n/fr/features/addition.feature +2 -2
  24. data/examples/i18n/fr/features/step_definitions/calculatrice_steps.rb +1 -1
  25. data/examples/i18n/id/features/addition.feature +6 -6
  26. data/examples/i18n/id/features/step_definitons/calculator_steps.rb +2 -2
  27. data/examples/i18n/it/features/step_definitons/calcolatrice_steps.rb +1 -1
  28. data/examples/i18n/ja/features/step_definitons/calculator_steps.rb +2 -3
  29. data/examples/i18n/ko/features/step_definitons/calculator_steps.rb +1 -1
  30. data/examples/i18n/lt/features/addition.feature +7 -6
  31. data/examples/i18n/lt/features/step_definitons/calculator_steps.rb +2 -2
  32. data/examples/i18n/no/features/step_definitons/kalkulator_steps.rb +7 -7
  33. data/examples/i18n/no/features/summering.feature +1 -0
  34. data/examples/i18n/pt/features/step_definitions/calculadora_steps.rb +1 -1
  35. data/examples/i18n/ro/features/step_definitons/calculator_steps.rb +1 -1
  36. data/examples/i18n/se/features/step_definitons/kalkulator_steps.rb +1 -1
  37. data/examples/i18n/zh-CN/features/step_definitons/calculator_steps.rb +2 -2
  38. data/examples/java/src/cucumber/demo/Hello.java +16 -0
  39. data/examples/jbehave/README.textile +17 -0
  40. data/examples/jbehave/features/support/env.rb +7 -0
  41. data/examples/jbehave/features/trading.feature +24 -0
  42. data/examples/jbehave/pom.xml +48 -0
  43. data/examples/jbehave/src/main/java/cukes/jbehave/examples/trader/converters/TraderConverter.java +32 -0
  44. data/examples/jbehave/src/main/java/cukes/jbehave/examples/trader/model/Stock.java +42 -0
  45. data/examples/jbehave/src/main/java/cukes/jbehave/examples/trader/model/Trader.java +29 -0
  46. data/examples/jbehave/src/main/java/cukes/jbehave/examples/trader/persistence/TraderPersister.java +22 -0
  47. data/examples/jbehave/src/main/java/cukes/jbehave/examples/trader/scenarios/TraderSteps.java +65 -0
  48. data/examples/self_test/README.textile +4 -1
  49. data/examples/{calculator_ruby_features → self_test}/Rakefile +3 -3
  50. data/examples/self_test/features/background/failing_background.feature +10 -0
  51. data/examples/self_test/features/background/failing_background_after_success.feature +11 -0
  52. data/examples/self_test/features/background/multiline_args_background.feature +32 -0
  53. data/examples/self_test/features/background/passing_background.feature +10 -0
  54. data/examples/self_test/features/background/pending_background.feature +10 -0
  55. data/examples/self_test/features/background/scenario_outline_failing_background.feature +16 -0
  56. data/examples/self_test/features/background/scenario_outline_passing_background.feature +16 -0
  57. data/examples/self_test/features/call_undefined_step_from_step_def.feature +7 -0
  58. data/examples/self_test/features/lots_of_undefined.feature +8 -0
  59. data/examples/self_test/features/outline_sample.feature +11 -5
  60. data/examples/self_test/features/sample.feature +8 -3
  61. data/examples/self_test/features/step_definitions/sample_steps.rb +53 -4
  62. data/examples/self_test/features/support/env.rb +1 -0
  63. data/examples/self_test/features/support/tag_count_formatter.rb +25 -0
  64. data/examples/tickets/features/172.feature +28 -0
  65. data/examples/tickets/features/177/1.feature +29 -0
  66. data/examples/tickets/features/177/2.feature +21 -0
  67. data/examples/tickets/features/177/3.feature +18 -0
  68. data/examples/tickets/features/180.feature +7 -0
  69. data/examples/tickets/features/scenario_outline.feature +6 -1
  70. data/examples/tickets/features/step_definitons/tickets_steps.rb +27 -3
  71. data/examples/tickets/features/tickets.feature +4 -0
  72. data/features/background.feature +223 -0
  73. data/features/cucumber_cli.feature +218 -98
  74. data/features/cucumber_cli_outlines.feature +54 -37
  75. data/features/custom_formatter.feature +11 -0
  76. data/features/report_called_undefined_steps.feature +32 -0
  77. data/features/step_definitions/cucumber_steps.rb +7 -3
  78. data/features/step_definitions/extra_steps.rb +1 -1
  79. data/features/support/env.rb +2 -1
  80. data/gem_tasks/flog.rake +1 -1
  81. data/gem_tasks/gemspec.rake +2 -2
  82. data/gem_tasks/jar.rake +67 -0
  83. data/lib/autotest/cucumber_mixin.rb +17 -23
  84. data/lib/cucumber.rb +63 -11
  85. data/lib/cucumber/ast.rb +29 -0
  86. data/lib/cucumber/ast/background.rb +88 -0
  87. data/lib/cucumber/ast/comment.rb +26 -0
  88. data/lib/cucumber/ast/examples.rb +26 -0
  89. data/lib/cucumber/ast/feature.rb +66 -0
  90. data/lib/cucumber/ast/features.rb +39 -0
  91. data/lib/cucumber/ast/filter.rb +22 -0
  92. data/lib/cucumber/ast/outline_table.rb +49 -0
  93. data/lib/cucumber/ast/py_string.rb +52 -0
  94. data/lib/cucumber/ast/scenario.rb +103 -0
  95. data/lib/cucumber/ast/scenario_outline.rb +92 -0
  96. data/lib/cucumber/ast/step.rb +161 -0
  97. data/lib/cucumber/ast/steps.rb +13 -0
  98. data/lib/cucumber/ast/table.rb +218 -0
  99. data/lib/cucumber/ast/tags.rb +40 -0
  100. data/lib/cucumber/ast/visitor.rb +109 -0
  101. data/lib/cucumber/broadcaster.rb +1 -6
  102. data/lib/cucumber/cli/configuration.rb +339 -0
  103. data/lib/cucumber/cli/language_help_formatter.rb +59 -0
  104. data/lib/cucumber/cli/main.rb +100 -0
  105. data/lib/cucumber/core_ext/exception.rb +41 -8
  106. data/lib/cucumber/core_ext/instance_exec.rb +54 -0
  107. data/lib/cucumber/core_ext/proc.rb +29 -65
  108. data/lib/cucumber/core_ext/string.rb +19 -0
  109. data/lib/cucumber/formatter.rb +1 -0
  110. data/lib/cucumber/{formatters → formatter}/ansicolor.rb +14 -16
  111. data/lib/cucumber/formatter/color_io.rb +17 -0
  112. data/lib/cucumber/formatter/console.rb +119 -0
  113. data/lib/cucumber/formatter/cucumber.css +55 -0
  114. data/lib/cucumber/formatter/cucumber.sass +49 -0
  115. data/lib/cucumber/formatter/html.rb +121 -0
  116. data/lib/cucumber/formatter/pretty.rb +167 -0
  117. data/lib/cucumber/formatter/profile.rb +77 -0
  118. data/lib/cucumber/formatter/progress.rb +68 -0
  119. data/lib/cucumber/formatter/rerun.rb +35 -0
  120. data/lib/cucumber/formatter/unicode.rb +35 -0
  121. data/lib/cucumber/formatters/unicode.rb +2 -35
  122. data/lib/cucumber/jbehave.rb +102 -0
  123. data/lib/cucumber/languages.yml +128 -75
  124. data/lib/cucumber/parser.rb +43 -0
  125. data/lib/cucumber/parser/basic.rb +0 -0
  126. data/lib/cucumber/parser/feature.rb +1490 -0
  127. data/lib/cucumber/parser/feature.tt +188 -0
  128. data/lib/cucumber/parser/i18n.tt +31 -0
  129. data/lib/cucumber/parser/table.rb +402 -0
  130. data/lib/cucumber/parser/table.tt +59 -0
  131. data/lib/cucumber/parser/treetop_ext.rb +75 -0
  132. data/lib/cucumber/platform.rb +3 -17
  133. data/lib/cucumber/rails/rspec.rb +5 -2
  134. data/lib/cucumber/step_definition.rb +87 -0
  135. data/lib/cucumber/step_mother.rb +151 -66
  136. data/lib/cucumber/version.rb +2 -2
  137. data/rails_generators/cucumber/USAGE +3 -2
  138. data/rails_generators/cucumber/cucumber_generator.rb +33 -23
  139. data/rails_generators/cucumber/templates/cucumber +2 -1
  140. data/rails_generators/cucumber/templates/cucumber.rake +6 -1
  141. data/rails_generators/cucumber/templates/env.rb +1 -1
  142. data/rails_generators/feature/USAGE +3 -0
  143. data/rails_generators/feature/feature_generator.rb +30 -6
  144. data/spec/cucumber/ast/background_spec.rb +58 -0
  145. data/spec/cucumber/ast/feature_factory.rb +54 -0
  146. data/spec/cucumber/ast/feature_spec.rb +60 -0
  147. data/spec/cucumber/ast/py_string_spec.rb +40 -0
  148. data/spec/cucumber/ast/scenario_outline_spec.rb +64 -0
  149. data/spec/cucumber/ast/scenario_spec.rb +82 -0
  150. data/spec/cucumber/ast/step_spec.rb +45 -0
  151. data/spec/cucumber/ast/table_spec.rb +81 -0
  152. data/spec/cucumber/ast/tags_spec.rb +23 -0
  153. data/spec/cucumber/broadcaster_spec.rb +4 -17
  154. data/spec/cucumber/cli/configuration_spec.rb +239 -0
  155. data/spec/cucumber/cli/main_spec.rb +164 -0
  156. data/spec/cucumber/core_ext/proc_spec.rb +27 -35
  157. data/spec/cucumber/core_ext/string_spec.rb +8 -0
  158. data/spec/cucumber/{formatters → formatter}/ansicolor_spec.rb +2 -2
  159. data/spec/cucumber/formatter/html/cucumber.css +37 -0
  160. data/spec/cucumber/formatter/html/cucumber.js +13 -0
  161. data/spec/cucumber/formatter/html/index.html +45 -0
  162. data/spec/cucumber/formatter/html/jquery-1.3.min.js +19 -0
  163. data/spec/cucumber/formatter/html/jquery.uitableedit.js +100 -0
  164. data/spec/cucumber/formatters/profile_formatter_spec.rb +17 -16
  165. data/spec/cucumber/parser/feature_parser_spec.rb +281 -0
  166. data/spec/cucumber/parser/table_parser_spec.rb +48 -0
  167. data/spec/cucumber/step_definition_spec.rb +62 -0
  168. data/spec/cucumber/step_mother_spec.rb +50 -51
  169. data/spec/cucumber/treetop_parser/empty_feature.feature +1 -1
  170. data/spec/cucumber/treetop_parser/scenario_outline.feature +1 -1
  171. data/spec/cucumber/treetop_parser/spaces.feature +3 -1
  172. data/spec/cucumber/treetop_parser/with_comments.feature +1 -1
  173. data/spec/cucumber/treetop_parser/with_tags.feature +18 -0
  174. data/spec/cucumber/world/pending_spec.rb +13 -12
  175. data/spec/spec_helper.rb +1 -1
  176. metadata +107 -79
  177. data/examples/calculator_ruby_features/features/addition.rb +0 -39
  178. data/examples/calculator_ruby_features/features/step_definitons/calculator_steps.rb +0 -43
  179. data/gem_tasks/treetop.rake +0 -41
  180. data/lib/cucumber/cli.rb +0 -355
  181. data/lib/cucumber/executor.rb +0 -205
  182. data/lib/cucumber/formatters.rb +0 -1
  183. data/lib/cucumber/formatters/autotest_formatter.rb +0 -23
  184. data/lib/cucumber/formatters/cucumber.css +0 -132
  185. data/lib/cucumber/formatters/cucumber.js +0 -11
  186. data/lib/cucumber/formatters/html_formatter.rb +0 -152
  187. data/lib/cucumber/formatters/jquery.js +0 -32
  188. data/lib/cucumber/formatters/pretty_formatter.rb +0 -285
  189. data/lib/cucumber/formatters/profile_formatter.rb +0 -92
  190. data/lib/cucumber/formatters/progress_formatter.rb +0 -61
  191. data/lib/cucumber/model.rb +0 -1
  192. data/lib/cucumber/model/table.rb +0 -32
  193. data/lib/cucumber/step_methods.rb +0 -49
  194. data/lib/cucumber/tree.rb +0 -16
  195. data/lib/cucumber/tree/feature.rb +0 -105
  196. data/lib/cucumber/tree/features.rb +0 -21
  197. data/lib/cucumber/tree/given_scenario.rb +0 -13
  198. data/lib/cucumber/tree/scenario.rb +0 -240
  199. data/lib/cucumber/tree/step.rb +0 -173
  200. data/lib/cucumber/tree/table.rb +0 -26
  201. data/lib/cucumber/tree/top_down_visitor.rb +0 -23
  202. data/lib/cucumber/treetop_parser/feature.treetop.erb +0 -254
  203. data/lib/cucumber/treetop_parser/feature_ar.rb +0 -1951
  204. data/lib/cucumber/treetop_parser/feature_cy.rb +0 -1951
  205. data/lib/cucumber/treetop_parser/feature_da.rb +0 -1951
  206. data/lib/cucumber/treetop_parser/feature_de.rb +0 -1951
  207. data/lib/cucumber/treetop_parser/feature_en-lol.rb +0 -1951
  208. data/lib/cucumber/treetop_parser/feature_en-tx.rb +0 -1951
  209. data/lib/cucumber/treetop_parser/feature_en.rb +0 -1951
  210. data/lib/cucumber/treetop_parser/feature_es.rb +0 -1951
  211. data/lib/cucumber/treetop_parser/feature_et.rb +0 -1951
  212. data/lib/cucumber/treetop_parser/feature_fi.rb +0 -1951
  213. data/lib/cucumber/treetop_parser/feature_fr.rb +0 -1951
  214. data/lib/cucumber/treetop_parser/feature_id.rb +0 -1951
  215. data/lib/cucumber/treetop_parser/feature_it.rb +0 -1951
  216. data/lib/cucumber/treetop_parser/feature_ja.rb +0 -1951
  217. data/lib/cucumber/treetop_parser/feature_ko.rb +0 -1951
  218. data/lib/cucumber/treetop_parser/feature_lt.rb +0 -1951
  219. data/lib/cucumber/treetop_parser/feature_nl.rb +0 -1951
  220. data/lib/cucumber/treetop_parser/feature_no.rb +0 -1951
  221. data/lib/cucumber/treetop_parser/feature_parser.rb +0 -36
  222. data/lib/cucumber/treetop_parser/feature_pl.rb +0 -1951
  223. data/lib/cucumber/treetop_parser/feature_pt.rb +0 -1951
  224. data/lib/cucumber/treetop_parser/feature_ro.rb +0 -1951
  225. data/lib/cucumber/treetop_parser/feature_ro2.rb +0 -1951
  226. data/lib/cucumber/treetop_parser/feature_ru.rb +0 -1951
  227. data/lib/cucumber/treetop_parser/feature_se.rb +0 -1951
  228. data/lib/cucumber/treetop_parser/feature_zh-CN.rb +0 -1951
  229. data/lib/cucumber/world.rb +0 -1
  230. data/lib/cucumber/world/pending.rb +0 -22
  231. data/setup.rb +0 -1585
  232. data/spec/cucumber/cli_spec.rb +0 -521
  233. data/spec/cucumber/executor_spec.rb +0 -382
  234. data/spec/cucumber/formatters/autotest_formatter_spec.rb +0 -26
  235. data/spec/cucumber/formatters/features.html +0 -269
  236. data/spec/cucumber/formatters/html_formatter_spec.rb +0 -110
  237. data/spec/cucumber/formatters/pretty_formatter_spec.rb +0 -410
  238. data/spec/cucumber/formatters/progress_formatter_spec.rb +0 -81
  239. data/spec/cucumber/model/table_spec.rb +0 -32
  240. data/spec/cucumber/tree/feature_spec.rb +0 -122
  241. data/spec/cucumber/tree/row_scenario_outline_spec.rb +0 -73
  242. data/spec/cucumber/tree/row_scenario_spec.rb +0 -55
  243. data/spec/cucumber/tree/row_step_outline_spec.rb +0 -38
  244. data/spec/cucumber/tree/scenario_outline_spec.rb +0 -50
  245. data/spec/cucumber/tree/scenario_spec.rb +0 -134
  246. data/spec/cucumber/tree/step_outline_spec.rb +0 -17
  247. data/spec/cucumber/tree/step_spec.rb +0 -59
  248. data/spec/cucumber/treetop_parser/feature_parser_spec.rb +0 -120
@@ -0,0 +1,10 @@
1
+ Feature: Passing background sample
2
+
3
+ Background:
4
+ Given '10' cukes
5
+
6
+ Scenario: passing background
7
+ Then I should have '10' cukes
8
+
9
+ Scenario: another passing background
10
+ Then I should have '10' cukes
@@ -0,0 +1,10 @@
1
+ Feature: Pending background sample
2
+
3
+ Background:
4
+ Given pending
5
+
6
+ Scenario: pending background
7
+ Then I should have '10' cukes
8
+
9
+ Scenario: another pending background
10
+ Then I should have '10' cukes
@@ -0,0 +1,16 @@
1
+ Feature: Failing background with scenario outlines sample
2
+
3
+ Background:
4
+ Given failing without a table
5
+
6
+ Scenario Outline: failing background
7
+ Then I should have '<count>' cukes
8
+ Examples:
9
+ |count|
10
+ | 10 |
11
+
12
+ Scenario Outline: another failing background
13
+ Then I should have '<count>' cukes
14
+ Examples:
15
+ |count|
16
+ | 10 |
@@ -0,0 +1,16 @@
1
+ Feature: Passing background with scenario outlines sample
2
+
3
+ Background:
4
+ Given '10' cukes
5
+
6
+ Scenario Outline: passing background
7
+ Then I should have '<count>' cukes
8
+ Examples:
9
+ |count|
10
+ | 10 |
11
+
12
+ Scenario Outline: another passing background
13
+ Then I should have '<count>' cukes
14
+ Examples:
15
+ |count|
16
+ | 10 |
@@ -0,0 +1,7 @@
1
+ Feature: Calling undefined step
2
+
3
+ Scenario: Call directly
4
+ Given a step definition that calls an undefined step
5
+
6
+ Scenario: Call via another
7
+ Given call step "a step definition that calls an undefined step"
@@ -0,0 +1,8 @@
1
+ Feature: Lots of undefined
2
+
3
+ Scenario: Implement me
4
+ Given it snows in Sahara
5
+ Given it's 40 degrees in Norway
6
+ And it's 40 degrees in Norway
7
+ When I stop procrastinating
8
+ And there is world peace
@@ -1,9 +1,15 @@
1
1
  Feature: Outline Sample
2
2
 
3
+ Scenario: I have no steps
4
+
3
5
  Scenario Outline: Test state
4
6
  Given <state> without a table
5
- Examples:
6
- | state |
7
- | missing |
8
- | passing |
9
- | failing |
7
+ Given <other_state> without a table
8
+ Examples: Rainbow colours
9
+ | state | other_state |
10
+ | missing | passing|
11
+ | passing| passing |
12
+ | failing | passing |
13
+ Examples:Only passing
14
+ | state | other_state |
15
+ | passing | passing |
@@ -1,14 +1,19 @@
1
+ @one
1
2
  Feature: Sample
2
3
 
4
+ @two @three
3
5
  Scenario: Missing
4
6
  Given missing
5
7
 
8
+ @three
6
9
  Scenario: Passing
7
10
  Given passing
8
11
  |a|b|
9
12
  |c|d|
10
-
13
+
14
+ @four
11
15
  Scenario: Failing
12
16
  Given failing
13
- |e|f|
14
- |g|h|
17
+ """
18
+ hello
19
+ """
@@ -1,13 +1,62 @@
1
+ def flunker
2
+ raise "FAIL"
3
+ end
4
+
1
5
  Given /^passing$/ do |table|
2
6
  end
3
7
 
4
- Given /^failing$/ do |table|
5
- raise "FAIL"
8
+ Given /^failing$/ do |string|
9
+ flunker
6
10
  end
7
11
 
8
12
  Given /^passing without a table$/ do
9
13
  end
10
14
 
11
15
  Given /^failing without a table$/ do
12
- raise "FAIL"
13
- end
16
+ flunker
17
+ end
18
+
19
+ Given /^a step definition that calls an undefined step$/ do
20
+ Given 'this does not exist'
21
+ end
22
+
23
+ Given /^call step "(.*)"$/ do |step|
24
+ Given step
25
+ end
26
+
27
+ Given /^'(.+)' cukes$/ do |cukes|
28
+ @cukes = cukes
29
+ end
30
+
31
+ Then /^I should have '(.+)' cukes$/ do |cukes|
32
+ @cukes.should == cukes
33
+ end
34
+
35
+ Given /^'(.+)' global cukes$/ do |cukes|
36
+ $scenario_runs ||= 0
37
+ flunker if $scenario_runs > 0
38
+ $cukes = cukes
39
+ $scenario_runs += 1
40
+ end
41
+
42
+ Then /^I should have '(.+)' global cukes$/ do |cukes|
43
+ $cukes.should == cukes
44
+ end
45
+
46
+ Given /^table$/ do |table|
47
+ @table = table
48
+ end
49
+
50
+ Given /^multiline string$/ do |string|
51
+ @multiline = string
52
+ end
53
+
54
+ Then /^the table should be$/ do |table|
55
+ @table.to_sexp.should == table.to_sexp
56
+ end
57
+
58
+ Then /^the multiline string should be$/ do |string|
59
+ @multiline.should == string
60
+ end
61
+
62
+
@@ -0,0 +1 @@
1
+ require 'spec/expectations'
@@ -0,0 +1,25 @@
1
+ module Tag
2
+ # Custom formatter that reports occurrences of each tag
3
+ class Count < Cucumber::Ast::Visitor
4
+ def initialize(step_mother, io, options)
5
+ super(step_mother)
6
+ @io = io
7
+ @counts = Hash.new{|h,k| h[k] = 0}
8
+ end
9
+
10
+ def visit_features(features)
11
+ super
12
+ print_summary
13
+ end
14
+
15
+ def visit_tag_name(tag_name)
16
+ @counts[tag_name] += 1
17
+ end
18
+
19
+ def print_summary
20
+ matrix = @counts.to_a.sort{|paira, pairb| paira[0] <=> pairb[0]}.transpose
21
+ table = Cucumber::Ast::Table.new(matrix)
22
+ Cucumber::Formatter::Pretty.new(@step_mother, @io, {}).visit_multiline_arg(table, :tag)
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,28 @@
1
+ Feature: Login
2
+ To ensure the safety of the application
3
+ A regular user of the system
4
+ Must authenticate before using the app
5
+
6
+
7
+ Scenario Outline: Failed Login
8
+ Given the user "known_user"
9
+
10
+ When I go to the main page
11
+ Then I should see the login form
12
+
13
+ When I fill in "login" with "<login>"
14
+ And I fill in "password" with "<password>"
15
+ And I press "Log In"
16
+ Then the login request should fail
17
+ And I should see the error message "Login or Password incorrect"
18
+
19
+ Examples:
20
+ | login | password |
21
+ | | |
22
+ | unknown_user | |
23
+ | known_user | |
24
+ | | wrong_password |
25
+ | | known_userpass |
26
+ | unknown_user | wrong_password |
27
+ | unknown_user | known_userpass |
28
+ | known_user | wrong_password |
@@ -0,0 +1,29 @@
1
+ Users want to know that nobody can masquerade as them. We want to extend trust
2
+ only to visitors who present the appropriate credentials. Everyone wants this
3
+ identity verification to be as secure and convenient as possible.
4
+
5
+ Feature: Logging in
6
+ As an anonymous user with an account
7
+ I want to log in to my account
8
+ So that I can be myself
9
+
10
+ #
11
+ # Log in: get form
12
+ #
13
+ Scenario: Anonymous user can get a login form.
14
+ Given I am logged out
15
+ When I go to "/login"
16
+ Then I should be at the "sessions/new" page
17
+
18
+ #
19
+ # Log in successfully, but don't remember me
20
+ #
21
+ Scenario: Anonymous user can log in
22
+ Given an "activated" user named "reggie" exists
23
+ And I am logged out
24
+ When I go to "/login"
25
+ And I fill in "Login" with "reggie"
26
+ And I fill in "Password" with "password"
27
+ And I press "Log in"
28
+ Then I should be at the "dashboard/index" page
29
+
@@ -0,0 +1,21 @@
1
+ Visitors may create an account, but for those who are not already in the
2
+ system an someone must activate the account for them before it can be used.
3
+
4
+ Feature: Activating an account
5
+ As a registered, but not yet activated, user
6
+ I want to be able to activate my account
7
+ So that I can log in to the site
8
+
9
+ Scenario: Not-yet-activated user can activate her account
10
+ Given a registered user named 'Reggie' # need to rewrite
11
+ # And the user has activation_code: 'activate_me', activated_at: nil!
12
+ # And we try hard to remember the user's updated_at, and created_at
13
+ # When she goes to /activate/activate_me
14
+ # Then she should be redirected to 'login'
15
+ # When she follows that redirect!
16
+ # Then she should see a notice message 'Signup complete!'
17
+ # And a user with login: 'reggie' should exist
18
+ # And the user should have login: 'reggie', and email: 'registered@example.com'
19
+ # And the user's activation_code should be nil
20
+ # And the user's activated_at should not be nil
21
+ # And she should not be logged in
@@ -0,0 +1,18 @@
1
+ Feature: Matt's example with a comment before a step
2
+
3
+ Scenario: Upload an image for an artist and create a concert in the process
4
+ Given I am logged in to my account
5
+ And there is one Artist named "Pixies"
6
+ And there is one Venue
7
+ When I visit the page for the Artist
8
+ And I follow "add a photo"
9
+ And I upload an Image
10
+ # Search on select concert page
11
+ And I press "Search Pixies concerts"
12
+ And I follow "Add a new Concert"
13
+ And I fill in new Concert information
14
+ And I press "Preview"
15
+ And I press "Add concert"
16
+ # No artists appear in this photo
17
+ And I press "Submit"
18
+ Then my Concert should exist with 1 Image
@@ -0,0 +1,7 @@
1
+ Feature: Cucumber command line
2
+ In order to write better software
3
+ Developers should be able to execute requirements as tests
4
+
5
+
6
+ Scenario: Pending Scenario at the end of a file with whitespace after it
7
+
@@ -19,10 +19,15 @@ Feature: Outlines
19
19
  Then I should have <left> cucumbers
20
20
  And I should have <eat> cucumbers in my belly
21
21
 
22
- Examples:
22
+ Examples: Lots of cukes
23
23
  | start | eat | left |
24
24
  | 12 | 5 | 7 |
25
25
  | 20 | 5 | 15 |
26
+
27
+ Examples: Ridiculous amounts of cukes
28
+ | start | eat | left |
29
+ | 120 | 50 | 70 |
30
+ | 200 | 50 | 150 |
26
31
 
27
32
  Scenario Outline: no placeholders
28
33
  Given there are 12 cucumbers
@@ -4,20 +4,44 @@ World do
4
4
  Object.new
5
5
  end
6
6
 
7
+ After do |scenario|
8
+ if scenario.status.index(:failed)
9
+ # Call the BDD police
10
+ end
11
+ end
12
+
7
13
  Given "be_empty" do
8
14
  [1,2].should_not be_empty
9
15
  end
10
16
 
11
17
  Given "nested step is called" do
12
- Given "nested step"
18
+ Given "I like mushroom", Cucumber::Ast::Table.new([
19
+ %w{sponge bob},
20
+ %w{is cool}
21
+ ])
22
+ end
23
+
24
+ Given 'nested step is called using text table' do
25
+ Given "I like mushroom", table(%{
26
+ | sponge | bob |
27
+ | is | cool |
28
+ })
29
+
30
+ # Alternative syntax (file and line will be reported on parse error)
31
+ # Given "I like mushroom", table(<<-EOT, __FILE__, __LINE__)
32
+ # | sponge | bob |
33
+ # | is | cool
34
+ # EOT
13
35
  end
14
36
 
15
- Given "nested step" do
16
- @magic = 'mushroom'
37
+ Given "I like $what" do |what, table|
38
+ @magic = what
39
+ @tool = table.raw[0][0]
17
40
  end
18
41
 
19
42
  Then "nested step should be executed" do
20
43
  @magic.should == 'mushroom'
44
+ @tool.should == 'sponge'
21
45
  end
22
46
 
23
47
  Given /^the following table$/ do |table|
@@ -9,6 +9,10 @@ Feature: Cucumber
9
9
  Scenario: Call step from step
10
10
  Given nested step is called
11
11
  Then nested step should be executed
12
+
13
+ Scenario: Call step from step using text table
14
+ Given nested step is called using text table
15
+ Then nested step should be executed
12
16
 
13
17
  Scenario: Reading a table
14
18
  Given the following table
@@ -0,0 +1,223 @@
1
+ Feature: backgrounds
2
+ In order to provide a context to my scenarios within a feature
3
+ As a feature editor
4
+ I want to write a background section in my features.
5
+
6
+ Scenario: run a specific scenario with a background
7
+ When I run cucumber -q features/background/passing_background.feature:9 --require features
8
+ Then it should pass with
9
+ """
10
+ Feature: Passing background sample
11
+
12
+ Background:
13
+ Given '10' cukes
14
+
15
+ Scenario: another passing background
16
+ Then I should have '10' cukes
17
+
18
+ 1 scenario
19
+ 2 passed steps
20
+
21
+ """
22
+
23
+ Scenario: run a feature with a background that passes
24
+ When I run cucumber -q features/background/passing_background.feature --require features
25
+ Then it should pass with
26
+ """
27
+ Feature: Passing background sample
28
+
29
+ Background:
30
+ Given '10' cukes
31
+
32
+ Scenario: passing background
33
+ Then I should have '10' cukes
34
+
35
+ Scenario: another passing background
36
+ Then I should have '10' cukes
37
+
38
+ 2 scenarios
39
+ 4 passed steps
40
+
41
+ """
42
+
43
+ Scenario: run a feature with scenario outlines that has a background that passes
44
+ When I run cucumber -q features/background/scenario_outline_passing_background.feature --require features
45
+ Then it should pass with
46
+ """
47
+ Feature: Passing background with scenario outlines sample
48
+
49
+ Background:
50
+ Given '10' cukes
51
+
52
+ Scenario Outline: passing background
53
+ Then I should have '<count>' cukes
54
+
55
+ Examples:
56
+ | count |
57
+ | 10 |
58
+
59
+ Scenario Outline: another passing background
60
+ Then I should have '<count>' cukes
61
+
62
+ Examples:
63
+ | count |
64
+ | 10 |
65
+
66
+ 2 scenarios
67
+ 4 passed steps
68
+
69
+ """
70
+
71
+ Scenario: run a feature with a background that fails
72
+ When I run cucumber -q features/background/failing_background.feature --require features
73
+ Then it should fail with
74
+ """
75
+ Feature: Failing background sample
76
+
77
+ Background:
78
+ Given failing without a table
79
+ FAIL (RuntimeError)
80
+ ./features/step_definitions/sample_steps.rb:2:in `flunker'
81
+ ./features/step_definitions/sample_steps.rb:16:in `/^failing without a table$/'
82
+ features/background/failing_background.feature:4:in `Given failing without a table'
83
+
84
+ Scenario: failing background
85
+ Then I should have '10' cukes
86
+
87
+ Scenario: another failing background
88
+ Then I should have '10' cukes
89
+
90
+ 2 scenarios
91
+ 2 failed steps
92
+ 2 skipped steps
93
+
94
+ """
95
+
96
+ Scenario: run a feature with scenario outlines that has a background that fails
97
+ When I run cucumber -q features/background/scenario_outline_failing_background.feature --require features
98
+ Then it should fail with
99
+ """
100
+ Feature: Failing background with scenario outlines sample
101
+
102
+ Background:
103
+ Given failing without a table
104
+ FAIL (RuntimeError)
105
+ ./features/step_definitions/sample_steps.rb:2:in `flunker'
106
+ ./features/step_definitions/sample_steps.rb:16:in `/^failing without a table$/'
107
+ features/background/scenario_outline_failing_background.feature:4:in `Given failing without a table'
108
+
109
+ Scenario Outline: failing background
110
+ Then I should have '<count>' cukes
111
+
112
+ Examples:
113
+ | count |
114
+ | 10 |
115
+
116
+ Scenario Outline: another failing background
117
+ Then I should have '<count>' cukes
118
+
119
+ Examples:
120
+ | count |
121
+ | 10 |
122
+
123
+ 2 scenarios
124
+ 2 failed steps
125
+ 2 skipped steps
126
+
127
+ """
128
+
129
+ Scenario: run a feature with a background that is pending
130
+ When I run cucumber -q features/background/pending_background.feature --require features
131
+ Then it should pass with
132
+ """
133
+ Feature: Pending background sample
134
+
135
+ Background:
136
+ Given pending
137
+
138
+ Scenario: pending background
139
+ Then I should have '10' cukes
140
+
141
+ Scenario: another pending background
142
+ Then I should have '10' cukes
143
+
144
+ 2 scenarios
145
+ 2 skipped steps
146
+ 2 undefined steps
147
+
148
+ """
149
+
150
+ Scenario: background passes with first scenario but fails with second
151
+ When I run cucumber -q features/background/failing_background_after_success.feature --require features
152
+ Then it should fail with
153
+ """
154
+ Feature: Failing background after previously successful background sample
155
+
156
+ Background:
157
+ Given passing without a table
158
+ And '10' global cukes
159
+
160
+ Scenario: passing background
161
+ Then I should have '10' global cukes
162
+
163
+ Background:
164
+ Given passing without a table
165
+ And '10' global cukes
166
+ FAIL (RuntimeError)
167
+ ./features/step_definitions/sample_steps.rb:2:in `flunker'
168
+ ./features/step_definitions/sample_steps.rb:37:in `/^'(.+)' global cukes$/'
169
+ features/background/failing_background_after_success.feature:3:in `And '10' global cukes'
170
+
171
+ Scenario: failing background
172
+ Then I should have '10' global cukes
173
+
174
+ 2 scenarios
175
+ 1 failed step
176
+ 1 skipped step
177
+ 4 passed steps
178
+
179
+ """
180
+
181
+ Scenario: background with multline args
182
+ When I run cucumber -q features/background/multiline_args_background.feature --require features
183
+ Then it should pass with
184
+ """
185
+ Feature: Passing background with multiline args
186
+
187
+ Background:
188
+ Given table
189
+ | a | b |
190
+ | c | d |
191
+ And multiline string
192
+ \"\"\"
193
+ I'm a cucumber and I'm okay.
194
+ I sleep all night and I test all day
195
+ \"\"\"
196
+
197
+ Scenario: passing background
198
+ Then the table should be
199
+ | a | b |
200
+ | c | d |
201
+ Then the multiline string should be
202
+ \"\"\"
203
+ I'm a cucumber and I'm okay.
204
+ I sleep all night and I test all day
205
+ \"\"\"
206
+
207
+ Scenario: another passing background
208
+ Then the table should be
209
+ | a | b |
210
+ | c | d |
211
+ Then the multiline string should be
212
+ \"\"\"
213
+ I'm a cucumber and I'm okay.
214
+ I sleep all night and I test all day
215
+ \"\"\"
216
+
217
+ 2 scenarios
218
+ 8 passed steps
219
+
220
+ """
221
+
222
+ @josephwilk
223
+ Scenario: run a scenario showing explicit background steps --explicit-background