aslakhellesoy-cucumber 0.1.99.23 → 0.1.100.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (83) hide show
  1. data/History.txt +2 -6
  2. data/Manifest.txt +8 -2
  3. data/examples/i18n/et/features/jagamine.feature +9 -0
  4. data/examples/jbehave/README.textile +4 -1
  5. data/examples/jbehave/features/trading.feature +4 -0
  6. data/examples/jbehave/pom.xml +5 -0
  7. data/examples/jbehave/src/main/java/cukes/jbehave/examples/trader/scenarios/TraderSteps.java +6 -1
  8. data/examples/selenium/features/step_definitons/search_steps.rb +13 -0
  9. data/examples/selenium/features/support/env.rb +19 -0
  10. data/examples/selenium_webrat/Rakefile +6 -0
  11. data/examples/selenium_webrat/features/search.feature +9 -0
  12. data/examples/selenium_webrat/features/step_definitons/search_steps.rb +13 -0
  13. data/examples/selenium_webrat/features/support/env.rb +41 -0
  14. data/examples/self_test/features/background/failing_background.feature +1 -0
  15. data/examples/self_test/features/step_definitions/sample_steps.rb +1 -1
  16. data/examples/self_test/features/support/tag_count_formatter.rb +1 -1
  17. data/features/background.feature +9 -11
  18. data/features/cucumber_cli.feature +24 -1
  19. data/features/cucumber_cli_outlines.feature +10 -19
  20. data/features/report_called_undefined_steps.feature +2 -0
  21. data/gem_tasks/rspec.rake +2 -0
  22. data/lib/cucumber.rb +7 -15
  23. data/lib/cucumber/ast.rb +3 -3
  24. data/lib/cucumber/ast/background.rb +28 -66
  25. data/lib/cucumber/ast/examples.rb +15 -3
  26. data/lib/cucumber/ast/feature.rb +20 -24
  27. data/lib/cucumber/ast/feature_element.rb +46 -0
  28. data/lib/cucumber/ast/features.rb +2 -21
  29. data/lib/cucumber/ast/outline_table.rb +46 -14
  30. data/lib/cucumber/ast/py_string.rb +8 -3
  31. data/lib/cucumber/ast/scenario.rb +34 -73
  32. data/lib/cucumber/ast/scenario_outline.rb +40 -42
  33. data/lib/cucumber/ast/step.rb +53 -89
  34. data/lib/cucumber/ast/step_collection.rb +66 -0
  35. data/lib/cucumber/ast/step_invocation.rb +106 -0
  36. data/lib/cucumber/ast/table.rb +38 -19
  37. data/lib/cucumber/ast/tags.rb +4 -11
  38. data/lib/cucumber/ast/visitor.rb +31 -19
  39. data/lib/cucumber/broadcaster.rb +1 -1
  40. data/lib/cucumber/cli/configuration.rb +24 -16
  41. data/lib/cucumber/cli/language_help_formatter.rb +4 -4
  42. data/lib/cucumber/cli/main.rb +5 -4
  43. data/lib/cucumber/core_ext/proc.rb +2 -2
  44. data/lib/cucumber/formatter/ansicolor.rb +0 -1
  45. data/lib/cucumber/formatter/console.rb +18 -34
  46. data/lib/cucumber/formatter/html.rb +13 -10
  47. data/lib/cucumber/formatter/pretty.rb +48 -36
  48. data/lib/cucumber/formatter/profile.rb +6 -6
  49. data/lib/cucumber/formatter/progress.rb +12 -20
  50. data/lib/cucumber/formatter/rerun.rb +5 -5
  51. data/lib/cucumber/jbehave.rb +21 -26
  52. data/lib/cucumber/parser/feature.rb +26 -29
  53. data/lib/cucumber/parser/feature.tt +17 -12
  54. data/lib/cucumber/parser/treetop_ext.rb +13 -13
  55. data/lib/cucumber/platform.rb +0 -1
  56. data/lib/cucumber/rails/world.rb +2 -2
  57. data/lib/cucumber/rake/task.rb +0 -1
  58. data/lib/cucumber/step_definition.rb +21 -12
  59. data/lib/cucumber/step_match.rb +49 -0
  60. data/lib/cucumber/step_mother.rb +98 -80
  61. data/lib/cucumber/version.rb +2 -2
  62. data/lib/cucumber/world.rb +42 -0
  63. data/rails_generators/cucumber/templates/paths.rb +1 -1
  64. data/rails_generators/cucumber/templates/webrat_steps.rb +17 -17
  65. data/rails_generators/feature/feature_generator.rb +4 -0
  66. data/rails_generators/feature/templates/steps.erb +0 -4
  67. data/spec/cucumber/ast/background_spec.rb +32 -41
  68. data/spec/cucumber/ast/feature_factory.rb +10 -1
  69. data/spec/cucumber/ast/feature_spec.rb +7 -30
  70. data/spec/cucumber/ast/scenario_outline_spec.rb +3 -0
  71. data/spec/cucumber/ast/scenario_spec.rb +8 -25
  72. data/spec/cucumber/ast/step_collection_spec.rb +8 -0
  73. data/spec/cucumber/ast/step_spec.rb +37 -29
  74. data/spec/cucumber/ast/tags_spec.rb +2 -18
  75. data/spec/cucumber/cli/configuration_spec.rb +7 -0
  76. data/spec/cucumber/cli/main_spec.rb +1 -1
  77. data/spec/cucumber/parser/feature_parser_spec.rb +6 -5
  78. data/spec/cucumber/step_definition_spec.rb +5 -5
  79. data/spec/cucumber/step_mother_spec.rb +6 -6
  80. data/spec/cucumber/world/pending_spec.rb +1 -1
  81. metadata +17 -5
  82. data/lib/cucumber/ast/filter.rb +0 -22
  83. data/lib/cucumber/ast/steps.rb +0 -13
data/History.txt CHANGED
@@ -58,11 +58,6 @@ pure Ruby users have been enjoying for a while.
58
58
 
59
59
  == TODO Before 0.2 release
60
60
  * Make sure all features and specs pass on Windows, JRuby and Ruby 1.9
61
- * Tighten up and simplify the grammar. More edge case features/specs.
62
- * Reintroduce StepInvocation. Reduce some of the redundant calls to StepDefinition/StepMother. Align with JBehave.
63
- * Make some class diagrams.
64
- * Implement at least a basic HTML formatter
65
- * Run a single cucumber feature from rake "rake features FEATURE=/path/to/feature:line"
66
61
  * Wiki page about running subsets
67
62
  ** file:line
68
63
  *** scenario (or step within)
@@ -79,6 +74,7 @@ pure Ruby users have been enjoying for a while.
79
74
  ** Full jar and simple jar
80
75
 
81
76
  == Bugfixes
77
+ * Re-structure the ast: Feature -> Background -> (Scenario|ScenarioOutline)*. Fixes bug with background being called outside transactions. (#181 Joseph Wilk)
82
78
  * --strict always exits with status 1 (#230 Tim Cuthbertson)
83
79
  * Fix error with nil values in tables raising an exception (#227 Joseph Wilk)
84
80
  * Add support for using << in formatters to ensure the html formatter works (#210 Joseph Wilk)
@@ -136,7 +132,7 @@ pure Ruby users have been enjoying for a while.
136
132
  * Pure Ruby features are no longer supported.
137
133
  * Remove --color option in autotest. Can be added manually in cucumber.yml (#215 Jean-Michel Garnier)
138
134
 
139
- == (0.16.4 aslakhellesoy-webrat gem on GitHub)
135
+ == (0.16.4 aslakhellesoy-cucumber gem on GitHub)
140
136
 
141
137
  Bugfix release.
142
138
 
data/Manifest.txt CHANGED
@@ -127,6 +127,7 @@ examples/jbehave/src/main/java/cukes/jbehave/examples/trader/model/Stock.java
127
127
  examples/jbehave/src/main/java/cukes/jbehave/examples/trader/model/Trader.java
128
128
  examples/jbehave/src/main/java/cukes/jbehave/examples/trader/persistence/TraderPersister.java
129
129
  examples/jbehave/src/main/java/cukes/jbehave/examples/trader/scenarios/TraderSteps.java
130
+ examples/jbehave/target/maven-archiver/pom.properties
130
131
  examples/selenium/Rakefile
131
132
  examples/selenium/features/search.feature
132
133
  examples/selenium/features/step_definitons/search_steps.rb
@@ -210,14 +211,15 @@ lib/cucumber/ast/background.rb
210
211
  lib/cucumber/ast/comment.rb
211
212
  lib/cucumber/ast/examples.rb
212
213
  lib/cucumber/ast/feature.rb
214
+ lib/cucumber/ast/feature_element.rb
213
215
  lib/cucumber/ast/features.rb
214
- lib/cucumber/ast/filter.rb
215
216
  lib/cucumber/ast/outline_table.rb
216
217
  lib/cucumber/ast/py_string.rb
217
218
  lib/cucumber/ast/scenario.rb
218
219
  lib/cucumber/ast/scenario_outline.rb
219
220
  lib/cucumber/ast/step.rb
220
- lib/cucumber/ast/steps.rb
221
+ lib/cucumber/ast/step_collection.rb
222
+ lib/cucumber/ast/step_invocation.rb
221
223
  lib/cucumber/ast/table.rb
222
224
  lib/cucumber/ast/tags.rb
223
225
  lib/cucumber/ast/visitor.rb
@@ -257,8 +259,10 @@ lib/cucumber/rails/rspec.rb
257
259
  lib/cucumber/rails/world.rb
258
260
  lib/cucumber/rake/task.rb
259
261
  lib/cucumber/step_definition.rb
262
+ lib/cucumber/step_match.rb
260
263
  lib/cucumber/step_mother.rb
261
264
  lib/cucumber/version.rb
265
+ lib/cucumber/world.rb
262
266
  rails_generators/cucumber/USAGE
263
267
  rails_generators/cucumber/cucumber_generator.rb
264
268
  rails_generators/cucumber/templates/cucumber
@@ -276,6 +280,7 @@ spec/cucumber/ast/feature_spec.rb
276
280
  spec/cucumber/ast/py_string_spec.rb
277
281
  spec/cucumber/ast/scenario_outline_spec.rb
278
282
  spec/cucumber/ast/scenario_spec.rb
283
+ spec/cucumber/ast/step_collection_spec.rb
279
284
  spec/cucumber/ast/step_spec.rb
280
285
  spec/cucumber/ast/table_spec.rb
281
286
  spec/cucumber/ast/tags_spec.rb
@@ -316,3 +321,4 @@ spec/cucumber/treetop_parser/with_tags.feature
316
321
  spec/cucumber/world/pending_spec.rb
317
322
  spec/spec.opts
318
323
  spec/spec_helper.rb
324
+ target/maven-archiver/pom.properties
@@ -0,0 +1,9 @@
1
+ Omadus: Jagamine
2
+ Rumalate vigade vältimiseks
3
+ Peavad kassapidajad saama arvutada murdudes
4
+
5
+ Stsenaarium: Tavalised numrbid
6
+ Eeldades et olen sisestanud kalkulaatorisse numbri 3
7
+ Ja olen sisestanud kalkulaatorisse numbri 2
8
+ Kui ma vajutan jaga
9
+ Siis vastuseks peab ekraanil kuvatama 1.5
@@ -8,7 +8,10 @@ First, compile the java code (and JBehave steps)
8
8
 
9
9
  <code>mvn compile jar:jar</code>
10
10
 
11
- Second, run Cucumber:
11
+ Second, set your CLASSPATH
12
+ <code>export CLASSPATH=~/.m2/repository/cucumber/cucumber-support/0.2/cucumber-support-0.2.jar:~/.m2/repository/org/jbehave/jbehave-core/2.1.1/jbehave-core-2.1.1.jar:~/.m2/repository/org/hamcrest/hamcrest-all/1.1/hamcrest-all-1.1.jar:~/.m2/repository/junit/junit/4.4/junit-4.4.jar</code>
13
+
14
+ Third, run Cucumber:
12
15
 
13
16
  <code>jruby -S cucumber features</code>
14
17
 
@@ -17,6 +17,10 @@ Feature: Trading
17
17
  Then the alert status should be OFF
18
18
 
19
19
  Scenario: Trader sells all stocks
20
+ # Given the following table
21
+ # | a | b |
22
+ # | 1 | 2 |
23
+ # | 3 | 4 |
20
24
  Given a trader of name Mauro
21
25
  Given a stock of prices 0.5,1.0 and a threshold of 1.5
22
26
  When the stock is traded at 2.0
@@ -18,6 +18,11 @@
18
18
  </repositories>
19
19
 
20
20
  <dependencies>
21
+ <dependency>
22
+ <groupId>cucumber</groupId>
23
+ <artifactId>cucumber-support</artifactId>
24
+ <version>0.2</version>
25
+ </dependency>
21
26
  <dependency>
22
27
  <groupId>org.jbehave</groupId>
23
28
  <artifactId>jbehave-core</artifactId>
@@ -18,6 +18,7 @@ import org.jbehave.scenario.steps.ParameterConverters;
18
18
  import org.jbehave.scenario.steps.SilentStepMonitor;
19
19
  import org.jbehave.scenario.steps.Steps;
20
20
  import org.jbehave.scenario.steps.StepsConfiguration;
21
+ import cucumber.ast.Table;
21
22
 
22
23
  public class TraderSteps extends Steps {
23
24
 
@@ -46,6 +47,11 @@ public class TraderSteps extends Steps {
46
47
  stock = new Stock(prices, threshold);
47
48
  }
48
49
 
50
+ @Given("the following table")
51
+ public void theFollowingTable(Table table) {
52
+ System.out.println("My table:" + table);
53
+ }
54
+
49
55
  @When("the stock is traded at %price")
50
56
  public void theStockIsTradedAt(double price) {
51
57
  stock.tradeAt(price);
@@ -61,5 +67,4 @@ public class TraderSteps extends Steps {
61
67
  trader.sellAllStocks();
62
68
  ensureThat(trader.getStocks().size(), equalTo(0));
63
69
  }
64
-
65
70
  }
@@ -0,0 +1,13 @@
1
+ Given 'I am on the Google search page' do
2
+ @browser.open('http://www.google.com/')
3
+ end
4
+
5
+ When /I search for "(.*)"/ do |query|
6
+ @browser.type('q', query)
7
+ @browser.click 'btnG'
8
+ @browser.wait_for_page_to_load
9
+ end
10
+
11
+ Then /I should see a link to (.*)/ do |expected_url|
12
+ @browser.is_element_present("css=a[href='#{expected_url}']").should be_true
13
+ end
@@ -0,0 +1,19 @@
1
+ require 'spec/expectations'
2
+ require 'selenium'
3
+
4
+ # "before all"
5
+ browser = Selenium::SeleniumDriver.new("localhost", 4444, "*chrome", "http://localhost", 15000)
6
+
7
+ Before do
8
+ @browser = browser
9
+ @browser.start
10
+ end
11
+
12
+ After do
13
+ @browser.stop
14
+ end
15
+
16
+ # "after all"
17
+ at_exit do
18
+ browser.close rescue nil
19
+ end
@@ -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 = "--format pretty"
6
+ end
@@ -0,0 +1,9 @@
1
+ Feature: Search
2
+ In order to learn more
3
+ As an information seeker
4
+ I want to find more information
5
+
6
+ Scenario: Find what I'm looking for
7
+ Given I am on the Google search page
8
+ When I search for "rspec"
9
+ Then I should see a link to http://rspec.info/
@@ -0,0 +1,13 @@
1
+ Given 'I am on the Google search page' do
2
+ visit('http://www.google.com/')
3
+ end
4
+
5
+ When /I search for "(.*)"/ do |query|
6
+ fill_in('q', :with => query)
7
+ click_button('btnG')
8
+ selenium.wait_for_page_to_load
9
+ end
10
+
11
+ Then /I should see a link to (.*)/ do |expected_url|
12
+ click_link(expected_url)
13
+ end
@@ -0,0 +1,41 @@
1
+ require 'spec/expectations'
2
+
3
+ # START HACK
4
+ # Webrat's Selenium wrongly assumes Rails in available. # We'll just fool it...
5
+ module ActionController
6
+ class IntegrationTest
7
+ end
8
+ end
9
+
10
+ def silence_stream(*args)
11
+ yield if block_given?
12
+ end
13
+ # END HACK
14
+
15
+ # RSpec
16
+ require 'spec/expectations'
17
+
18
+ # Webrat
19
+ require 'webrat'
20
+ Webrat.configure do |config|
21
+ config.mode = :selenium
22
+ end
23
+
24
+ World do
25
+ session = Webrat::SeleniumSession.new
26
+ session.extend(Webrat::Methods)
27
+ session.extend(Webrat::Selenium::Methods)
28
+ session.extend(Webrat::Selenium::Matchers)
29
+ session
30
+ end
31
+
32
+ # START HACK
33
+ # Disable Rails-specific code
34
+ module Webrat
35
+ def self.start_app_server
36
+ end
37
+
38
+ def self.stop_app_server
39
+ end
40
+ end
41
+ # END HACK
@@ -2,6 +2,7 @@ Feature: Failing background sample
2
2
 
3
3
  Background:
4
4
  Given failing without a table
5
+ And '10' cukes
5
6
 
6
7
  Scenario: failing background
7
8
  Then I should have '10' cukes
@@ -34,7 +34,7 @@ end
34
34
 
35
35
  Given /^'(.+)' global cukes$/ do |cukes|
36
36
  $scenario_runs ||= 0
37
- flunker if $scenario_runs > 0
37
+ flunker if $scenario_runs >= 1
38
38
  $cukes = cukes
39
39
  $scenario_runs += 1
40
40
  end
@@ -19,7 +19,7 @@ module Tag
19
19
  def print_summary
20
20
  matrix = @counts.to_a.sort{|paira, pairb| paira[0] <=> pairb[0]}.transpose
21
21
  table = Cucumber::Ast::Table.new(matrix)
22
- Cucumber::Formatter::Pretty.new(@step_mother, @io, {}).visit_multiline_arg(table, :tag)
22
+ Cucumber::Formatter::Pretty.new(@step_mother, @io, {}).visit_multiline_arg(table)
23
23
  end
24
24
  end
25
25
  end
@@ -16,7 +16,7 @@ Feature: backgrounds
16
16
  Then I should have '10' cukes
17
17
 
18
18
  1 scenario
19
- 2 passed steps
19
+ 3 passed steps
20
20
 
21
21
  """
22
22
 
@@ -64,7 +64,7 @@ Feature: backgrounds
64
64
  | 10 |
65
65
 
66
66
  2 scenarios
67
- 4 passed steps
67
+ 5 passed steps
68
68
 
69
69
  """
70
70
 
@@ -80,6 +80,7 @@ Feature: backgrounds
80
80
  ./features/step_definitions/sample_steps.rb:2:in `flunker'
81
81
  ./features/step_definitions/sample_steps.rb:16:in `/^failing without a table$/'
82
82
  features/background/failing_background.feature:4:in `Given failing without a table'
83
+ And '10' cukes
83
84
 
84
85
  Scenario: failing background
85
86
  Then I should have '10' cukes
@@ -88,8 +89,8 @@ Feature: backgrounds
88
89
  Then I should have '10' cukes
89
90
 
90
91
  2 scenarios
91
- 2 failed steps
92
- 2 skipped steps
92
+ 1 failed step
93
+ 5 skipped steps
93
94
 
94
95
  """
95
96
 
@@ -121,8 +122,8 @@ Feature: backgrounds
121
122
  | 10 |
122
123
 
123
124
  2 scenarios
124
- 2 failed steps
125
- 2 skipped steps
125
+ 1 failed step
126
+ 4 skipped steps
126
127
 
127
128
  """
128
129
 
@@ -160,15 +161,12 @@ Feature: backgrounds
160
161
  Scenario: passing background
161
162
  Then I should have '10' global cukes
162
163
 
163
- Background:
164
- Given passing without a table
164
+ Scenario: failing background
165
165
  And '10' global cukes
166
166
  FAIL (RuntimeError)
167
167
  ./features/step_definitions/sample_steps.rb:2:in `flunker'
168
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
169
+ features/background/failing_background_after_success.feature:5:in `And '10' global cukes'
172
170
  Then I should have '10' global cukes
173
171
 
174
172
  2 scenarios
@@ -32,7 +32,7 @@ Feature: Cucumber command line
32
32
  features/sample.feature:6:in `Given missing'
33
33
 
34
34
  1 scenario
35
- 1 failed step
35
+ 1 undefined step
36
36
 
37
37
  """
38
38
 
@@ -337,6 +337,29 @@ Feature: Cucumber command line
337
337
 
338
338
  """
339
339
 
340
+ Scenario: Run with a negative tag
341
+ When I run cucumber -q features/sample.feature --dry-run -t ~four
342
+ Then it should pass with
343
+ """
344
+ @one
345
+ Feature: Sample
346
+
347
+ @two @three
348
+ Scenario: Missing
349
+ Given missing
350
+
351
+ @three
352
+ Scenario: Passing
353
+ Given passing
354
+ | a | b |
355
+ | c | d |
356
+
357
+ 2 scenarios
358
+ 1 skipped step
359
+ 1 undefined step
360
+
361
+ """
362
+
340
363
  Scenario: Reformat files with --autoformat
341
364
  When I run cucumber --autoformat tmp/formatted features
342
365
  Then examples/self_test/tmp/formatted/features/sample.feature should contain
@@ -17,10 +17,10 @@ Feature: Cucumber command line
17
17
  | missing | passing |
18
18
  | passing | passing |
19
19
  | failing | passing |
20
- FAIL (RuntimeError)
21
- ./features/step_definitions/sample_steps.rb:2:in `flunker'
22
- ./features/step_definitions/sample_steps.rb:16:in `/^failing without a table$/'
23
- features/outline_sample.feature:12:in `Given failing without a table'
20
+ FAIL (RuntimeError)
21
+ ./features/step_definitions/sample_steps.rb:2:in `flunker'
22
+ ./features/step_definitions/sample_steps.rb:16:in `/^failing without a table$/'
23
+ features/outline_sample.feature:6:in `Given <state> without a table'
24
24
 
25
25
  Examples: Only passing
26
26
  | state | other_state |
@@ -34,8 +34,6 @@ Feature: Cucumber command line
34
34
 
35
35
  """
36
36
 
37
- # The "Only Passing" should not be printed
38
- @buggy
39
37
  Scenario: Run single failing scenario outline table row
40
38
  When I run cucumber features/outline_sample.feature:12
41
39
  Then it should fail with
@@ -49,13 +47,10 @@ Feature: Cucumber command line
49
47
  Examples: Rainbow colours
50
48
  | state | other_state |
51
49
  | failing | passing |
52
- FAIL (RuntimeError)
53
- ./features/step_definitions/sample_steps.rb:2:in `flunker'
54
- ./features/step_definitions/sample_steps.rb:16:in `/^failing without a table$/'
55
- features/outline_sample.feature:12:in `Given failing without a table'
56
-
57
- Examples: Only passing
58
- | state | other_state |
50
+ FAIL (RuntimeError)
51
+ ./features/step_definitions/sample_steps.rb:2:in `flunker'
52
+ ./features/step_definitions/sample_steps.rb:16:in `/^failing without a table$/'
53
+ features/outline_sample.feature:6:in `Given <state> without a table'
59
54
 
60
55
  1 scenario
61
56
  1 failed step
@@ -67,18 +62,14 @@ Feature: Cucumber command line
67
62
  When I run cucumber -q --format progress features/outline_sample.feature
68
63
  Then it should fail with
69
64
  """
70
- UUS..FS..
71
-
72
- (::) undefined scenarios (::)
73
-
74
- features/outline_sample.feature:3:in `Scenario: I have no steps'
65
+ ----U-..F---..
75
66
 
76
67
  (::) failed steps (::)
77
68
 
78
69
  FAIL (RuntimeError)
79
70
  ./features/step_definitions/sample_steps.rb:2:in `flunker'
80
71
  ./features/step_definitions/sample_steps.rb:16:in `/^failing without a table$/'
81
- features/outline_sample.feature:12:in `Given failing without a table'
72
+ features/outline_sample.feature:6:in `Given <state> without a table'
82
73
 
83
74
  5 scenarios
84
75
  1 failed step