cucumber 0.3.9 → 0.3.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. data/History.txt +40 -0
  2. data/Manifest.txt +10 -0
  3. data/cucumber.yml +1 -1
  4. data/examples/i18n/pl/Rakefile +6 -0
  5. data/examples/i18n/pl/features/addition.feature +16 -0
  6. data/examples/i18n/pl/features/division.feature +9 -0
  7. data/examples/i18n/pl/features/step_definitons/calculator_steps.rb +24 -0
  8. data/examples/i18n/pl/features/support/env.rb +6 -0
  9. data/examples/i18n/pl/lib/calculator.rb +14 -0
  10. data/examples/self_test/features/sample.feature +2 -0
  11. data/features/cucumber_cli.feature +24 -6
  12. data/features/drb_server_integration.feature +92 -0
  13. data/features/html_formatter/a.html +926 -437
  14. data/features/junit_formatter.feature +11 -2
  15. data/features/step_definitions/cucumber_steps.rb +15 -2
  16. data/features/support/env.rb +35 -1
  17. data/features/usage.feature +2 -2
  18. data/lib/cucumber/ast/background.rb +1 -1
  19. data/lib/cucumber/ast/comment.rb +4 -0
  20. data/lib/cucumber/ast/feature.rb +2 -1
  21. data/lib/cucumber/ast/outline_table.rb +2 -2
  22. data/lib/cucumber/ast/scenario.rb +1 -1
  23. data/lib/cucumber/ast/scenario_outline.rb +11 -4
  24. data/lib/cucumber/ast/step_invocation.rb +17 -12
  25. data/lib/cucumber/ast/visitor.rb +4 -0
  26. data/lib/cucumber/cli/configuration.rb +32 -8
  27. data/lib/cucumber/cli/drb_client.rb +21 -0
  28. data/lib/cucumber/cli/main.rb +9 -0
  29. data/lib/cucumber/formatter/color_io.rb +2 -2
  30. data/lib/cucumber/formatter/console.rb +1 -3
  31. data/lib/cucumber/formatter/html.rb +63 -12
  32. data/lib/cucumber/formatter/junit.rb +2 -2
  33. data/lib/cucumber/formatter/pretty.rb +2 -1
  34. data/lib/cucumber/formatter/rerun.rb +1 -0
  35. data/lib/cucumber/formatter/tag_cloud.rb +1 -0
  36. data/lib/cucumber/rails/rspec.rb +5 -3
  37. data/lib/cucumber/rake/task.rb +1 -1
  38. data/lib/cucumber/step_match.rb +6 -2
  39. data/lib/cucumber/step_mother.rb +11 -8
  40. data/lib/cucumber/version.rb +1 -1
  41. data/rails_generators/cucumber/cucumber_generator.rb +12 -2
  42. data/rails_generators/cucumber/templates/cucumber.rake +1 -1
  43. data/rails_generators/cucumber/templates/cucumber_environment.rb +6 -4
  44. data/rails_generators/cucumber/templates/env.rb +10 -3
  45. data/rails_generators/cucumber/templates/spork_env.rb +36 -0
  46. data/rails_generators/cucumber/templates/webrat_steps.rb +8 -0
  47. data/spec/cucumber/cli/configuration_spec.rb +56 -1
  48. data/spec/cucumber/cli/drb_client_spec.rb +42 -0
  49. data/spec/cucumber/cli/main_spec.rb +64 -19
  50. metadata +12 -2
@@ -1,3 +1,43 @@
1
+ == 0.3.10 2009-06-05
2
+
3
+ The Spork Release!
4
+
5
+ This release has an exciting new feature - a new --drb switch! This magic switch lets you run your
6
+ features much faster than before, because you can eliminate the startup time for your code. This is
7
+ thanks to a brand new gem called Spork by Tim Harper and Ben Mabey. (You can find out more about Spork
8
+ here: http://github.com/timcharper/spork/tree/master). You can start Spork and have it preload your
9
+ application in a separate process. Spork listens for DRb connections, and when you run cucumber with
10
+ --drb the features will run inside the Spork server instead. Spork provides two simple hooks for preloading
11
+ your application - one for framework/stable code (Spork.prefork) and one for the code that *you* write and
12
+ change often (Spork.each_run). Keep in mind that all World, Before, and other Cucumber hooks need to be
13
+ in the Spork.each_run block. Using Spork works great for Ruby on Rails, which can take a while to load,
14
+ but --drb and Spork aren't tied to Rails at all. The new --drb switch also works great alongside autotest
15
+ (just add --drb to your autotest profile in cucumber.yml), so now you can get even faster feedback.
16
+
17
+ Cucumber's built-in cucumber generator now has a new --spork switch, so when you bootstrap your Rails
18
+ application for cucumber, you can have spork configuration set up out of the box. (It's just a
19
+ slightly different env.rb.)
20
+
21
+ Although Spork was in mind when the --drb switch was added it is important to realize that all that was added
22
+ to Cucumber was a DRb client. Any DRb server that adheres to this protocol can be used with Cucumber's --drb
23
+ switch. While Spork is geared towards removing the load time to give you a faster feedback loop you could
24
+ just as easily use this client with a server that distributes your features to run in parallel. Someone just
25
+ needs to write such a server. ;)
26
+
27
+ This release also has some minor bugfixes related to RSpec and Rails interop.
28
+
29
+ === Bugfixes
30
+ * RSpec's be_* matchers did not work in 0.3.9 and probably earlier versions. Now they do. (Aslak Hellesøy)
31
+ * The Rails cucumber environment won't declare gem dependencies if the plugin exists. (Aslak Hellesøy)
32
+ * The Rails cucumber generator will no longer declare gem dependencies on rspec if you use --testunit. (Aslak Hellesøy)
33
+
34
+ === New features
35
+ * Spork support via --drb. (Ben Mabey)
36
+ * Added a Ast::Feature#name method for convenience. (Aslak Hellesøy)
37
+
38
+ === Changed features
39
+ * The HTML formatter wraps examples in a div, and distinguishes between Scenario and Scenario Outline. (Aslak Hellesøy)
40
+
1
41
  == 0.3.9 2009-05-27
2
42
 
3
43
  Bugfix release for 0.3.8 released earlier today. 0.3.8 had a bug in the Rails cucumber
@@ -115,6 +115,12 @@ examples/i18n/no/features/step_definitons/kalkulator_steps.rb
115
115
  examples/i18n/no/features/summering.feature
116
116
  examples/i18n/no/features/support/env.rb
117
117
  examples/i18n/no/lib/kalkulator.rb
118
+ examples/i18n/pl/Rakefile
119
+ examples/i18n/pl/features/addition.feature
120
+ examples/i18n/pl/features/division.feature
121
+ examples/i18n/pl/features/step_definitons/calculator_steps.rb
122
+ examples/i18n/pl/features/support/env.rb
123
+ examples/i18n/pl/lib/calculator.rb
118
124
  examples/i18n/pt/Rakefile
119
125
  examples/i18n/pt/features/adicao.feature
120
126
  examples/i18n/pt/features/step_definitions/calculadora_steps.rb
@@ -244,6 +250,7 @@ features/cucumber_cli.feature
244
250
  features/cucumber_cli_diff_disabled.feature
245
251
  features/cucumber_cli_outlines.feature
246
252
  features/custom_formatter.feature
253
+ features/drb_server_integration.feature
247
254
  features/exclude_files.feature
248
255
  features/expand.feature
249
256
  features/html_formatter.feature
@@ -292,6 +299,7 @@ lib/cucumber/ast/tags.rb
292
299
  lib/cucumber/ast/visitor.rb
293
300
  lib/cucumber/broadcaster.rb
294
301
  lib/cucumber/cli/configuration.rb
302
+ lib/cucumber/cli/drb_client.rb
295
303
  lib/cucumber/cli/language_help_formatter.rb
296
304
  lib/cucumber/cli/main.rb
297
305
  lib/cucumber/core_ext/exception.rb
@@ -339,6 +347,7 @@ rails_generators/cucumber/templates/cucumber.rake
339
347
  rails_generators/cucumber/templates/cucumber_environment.rb
340
348
  rails_generators/cucumber/templates/env.rb
341
349
  rails_generators/cucumber/templates/paths.rb
350
+ rails_generators/cucumber/templates/spork_env.rb
342
351
  rails_generators/cucumber/templates/webrat_steps.rb
343
352
  rails_generators/feature/USAGE
344
353
  rails_generators/feature/feature_generator.rb
@@ -357,6 +366,7 @@ spec/cucumber/ast/table_spec.rb
357
366
  spec/cucumber/ast/visitor_spec.rb
358
367
  spec/cucumber/broadcaster_spec.rb
359
368
  spec/cucumber/cli/configuration_spec.rb
369
+ spec/cucumber/cli/drb_client_spec.rb
360
370
  spec/cucumber/cli/main_spec.rb
361
371
  spec/cucumber/core_ext/proc_spec.rb
362
372
  spec/cucumber/core_ext/string_spec.rb
@@ -1 +1 @@
1
- default: --format progress features --tags ~@pending
1
+ default: --format progress features --tags ~@proposed,~@in_progress
@@ -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 = %w{--language pl}
6
+ end
@@ -0,0 +1,16 @@
1
+ Właściwość: Dodawanie
2
+ W celu uniknięcia głupich błędów
3
+ Jako matematyczny idiota
4
+ Chcę sprawdzić wartość sumy dwóch liczb
5
+
6
+ Szablon scenariusza: Dodaj dwie liczby
7
+ Zakładając wprowadzenie do kalkulatora liczby <liczba_1>
8
+ Oraz wprowadzenie do kalkulatora liczby <liczba_2>
9
+ Jeżeli nacisnę <przycisk>
10
+ Wtedy rezultat <wynik> wyświetli się na ekranie
11
+
12
+ Przykłady:
13
+ | liczba_1 | liczba_2 | przycisk | wynik |
14
+ | 20 | 30 | dodaj | 50 |
15
+ | 2 | 5 | dodaj | 7 |
16
+ | 0 | 40 | dodaj | 40 |
@@ -0,0 +1,9 @@
1
+ Właściwość: Dzielenie
2
+ W celu uniknięcia głupich błędów
3
+ Kasjer musi znać się na ułamkach
4
+
5
+ Scenariusz: Zwykłe liczby
6
+ Zakładając wprowadzenie do kalkulatora liczby 3
7
+ Oraz wprowadzenie do kalkulatora liczby 2
8
+ Jeżeli nacisnę podziel
9
+ Wtedy rezultat 1.5 wyświetli się na ekranie
@@ -0,0 +1,24 @@
1
+ # encoding: utf-8
2
+ require 'spec/expectations'
3
+ $:.unshift(File.dirname(__FILE__) + '/../../lib') # This line is not needed in your own project
4
+ require 'cucumber/formatter/unicode'
5
+ require 'calculator'
6
+
7
+ Before do
8
+ @calc = Calculator.new
9
+ end
10
+
11
+ After do
12
+ end
13
+
14
+ Zakładając /wprowadzenie do kalkulatora liczby (\d+)/ do |n|
15
+ @calc.push n.to_i
16
+ end
17
+
18
+ Jeżeli /nacisnę (\w+)/ do |op|
19
+ @result = @calc.send op
20
+ end
21
+
22
+ Wtedy /rezultat (.*) wyświetli się na ekranie/ do |result|
23
+ @result.should == result.to_f
24
+ end
@@ -0,0 +1,6 @@
1
+ # encoding: utf-8
2
+ require 'spec/expectations'
3
+ $:.unshift(File.dirname(__FILE__) + '/../../lib')
4
+ require 'cucumber/formatter/unicode'
5
+ require 'calculator'
6
+ $KCODE='u' unless Cucumber::RUBY_1_9
@@ -0,0 +1,14 @@
1
+ class Calculator
2
+ def push(n)
3
+ @args ||= []
4
+ @args << n
5
+ end
6
+
7
+ def dodaj
8
+ @args.inject(0){|n,sum| sum+=n}
9
+ end
10
+
11
+ def podziel
12
+ @args[0].to_f / @args[1].to_f
13
+ end
14
+ end
@@ -1,3 +1,4 @@
1
+ # Feature comment
1
2
  @one
2
3
  Feature: Sample
3
4
 
@@ -5,6 +6,7 @@ Feature: Sample
5
6
  Scenario: Missing
6
7
  Given missing
7
8
 
9
+ # Scenario comment
8
10
  @three
9
11
  Scenario: Passing
10
12
  Given passing
@@ -6,6 +6,7 @@ Feature: Cucumber command line
6
6
  When I run cucumber -q features/sample.feature:5
7
7
  Then it should pass with
8
8
  """
9
+ # Feature comment
9
10
  @one
10
11
  Feature: Sample
11
12
 
@@ -22,6 +23,7 @@ Feature: Cucumber command line
22
23
  When I run cucumber -q features/sample.feature:5 --strict
23
24
  Then it should fail with
24
25
  """
26
+ # Feature comment
25
27
  @one
26
28
  Feature: Sample
27
29
 
@@ -29,7 +31,7 @@ Feature: Cucumber command line
29
31
  Scenario: Missing
30
32
  Given missing
31
33
  Undefined step: "missing" (Cucumber::Undefined)
32
- features/sample.feature:6:in `Given missing'
34
+ features/sample.feature:7:in `Given missing'
33
35
 
34
36
  1 scenario (1 undefined)
35
37
  1 step (1 undefined)
@@ -37,12 +39,14 @@ Feature: Cucumber command line
37
39
  """
38
40
 
39
41
  Scenario: Succeed with --strict
40
- When I run cucumber -q features/sample.feature:9 --strict
42
+ When I run cucumber -q features/sample.feature:10 --strict
41
43
  Then it should pass with
42
44
  """
45
+ # Feature comment
43
46
  @one
44
47
  Feature: Sample
45
48
 
49
+ # Scenario comment
46
50
  @three
47
51
  Scenario: Passing
48
52
  Given passing
@@ -56,9 +60,10 @@ Feature: Cucumber command line
56
60
 
57
61
  @mri186
58
62
  Scenario: Specify 2 line numbers where one is a tag
59
- When I run cucumber -q features/sample.feature:5:14
63
+ When I run cucumber -q features/sample.feature:5:16
60
64
  Then it should fail with
61
65
  """
66
+ # Feature comment
62
67
  @one
63
68
  Feature: Sample
64
69
 
@@ -75,7 +80,7 @@ Feature: Cucumber command line
75
80
  FAIL (RuntimeError)
76
81
  ./features/step_definitions/sample_steps.rb:2:in `flunker'
77
82
  ./features/step_definitions/sample_steps.rb:9:in `/^failing$/'
78
- features/sample.feature:16:in `Given failing'
83
+ features/sample.feature:18:in `Given failing'
79
84
 
80
85
  2 scenarios (1 failed, 1 undefined)
81
86
  2 steps (1 failed, 1 undefined)
@@ -86,6 +91,7 @@ Feature: Cucumber command line
86
91
  When I run cucumber -q -r ../../features/step_definitions/extra_steps.rb features/sample.feature:5
87
92
  Then it should pass with
88
93
  """
94
+ # Feature comment
89
95
  @one
90
96
  Feature: Sample
91
97
 
@@ -102,9 +108,11 @@ Feature: Cucumber command line
102
108
  When I run cucumber -q features/sample.feature:12
103
109
  Then it should pass with
104
110
  """
111
+ # Feature comment
105
112
  @one
106
113
  Feature: Sample
107
114
 
115
+ # Scenario comment
108
116
  @three
109
117
  Scenario: Passing
110
118
  Given passing
@@ -128,7 +136,7 @@ Feature: Cucumber command line
128
136
  FAIL (RuntimeError)
129
137
  ./features/step_definitions/sample_steps.rb:2:in `flunker'
130
138
  ./features/step_definitions/sample_steps.rb:9:in `/^failing$/'
131
- features/sample.feature:16:in `Given failing'
139
+ features/sample.feature:18:in `Given failing'
132
140
 
133
141
  3 scenarios (1 failed, 1 undefined, 1 passed)
134
142
  3 steps (1 failed, 1 undefined, 1 passed)
@@ -238,6 +246,7 @@ Feature: Cucumber command line
238
246
  | state | other_state |
239
247
  | passing | passing |
240
248
 
249
+ # Feature comment
241
250
  @one
242
251
  Feature: Sample
243
252
 
@@ -245,6 +254,7 @@ Feature: Cucumber command line
245
254
  Scenario: Missing
246
255
  Given missing
247
256
 
257
+ # Scenario comment
248
258
  @three
249
259
  Scenario: Passing
250
260
  Given passing
@@ -388,6 +398,7 @@ Feature: Cucumber command line
388
398
  When I run cucumber -q features --tags three
389
399
  Then it should pass with
390
400
  """
401
+ # Feature comment
391
402
  @one
392
403
  Feature: Sample
393
404
 
@@ -395,6 +406,7 @@ Feature: Cucumber command line
395
406
  Scenario: Missing
396
407
  Given missing
397
408
 
409
+ # Scenario comment
398
410
  @three
399
411
  Scenario: Passing
400
412
  Given passing
@@ -411,6 +423,7 @@ Feature: Cucumber command line
411
423
  When I run cucumber -q features --tags one
412
424
  Then it should fail with
413
425
  """
426
+ # Feature comment
414
427
  @one
415
428
  Feature: Sample
416
429
 
@@ -418,6 +431,7 @@ Feature: Cucumber command line
418
431
  Scenario: Missing
419
432
  Given missing
420
433
 
434
+ # Scenario comment
421
435
  @three
422
436
  Scenario: Passing
423
437
  Given passing
@@ -433,7 +447,7 @@ Feature: Cucumber command line
433
447
  FAIL (RuntimeError)
434
448
  ./features/step_definitions/sample_steps.rb:2:in `flunker'
435
449
  ./features/step_definitions/sample_steps.rb:9:in `/^failing$/'
436
- features/sample.feature:16:in `Given failing'
450
+ features/sample.feature:18:in `Given failing'
437
451
 
438
452
  3 scenarios (1 failed, 1 undefined, 1 passed)
439
453
  3 steps (1 failed, 1 undefined, 1 passed)
@@ -444,6 +458,7 @@ Feature: Cucumber command line
444
458
  When I run cucumber -q features/sample.feature --dry-run -t ~four
445
459
  Then it should pass with
446
460
  """
461
+ # Feature comment
447
462
  @one
448
463
  Feature: Sample
449
464
 
@@ -451,6 +466,7 @@ Feature: Cucumber command line
451
466
  Scenario: Missing
452
467
  Given missing
453
468
 
469
+ # Scenario comment
454
470
  @three
455
471
  Scenario: Passing
456
472
  Given passing
@@ -466,6 +482,7 @@ Feature: Cucumber command line
466
482
  When I run cucumber --autoformat tmp/formatted features
467
483
  Then "examples/self_test/tmp/formatted/features/sample.feature" should contain
468
484
  """
485
+ # Feature comment
469
486
  @one
470
487
  Feature: Sample
471
488
 
@@ -473,6 +490,7 @@ Feature: Cucumber command line
473
490
  Scenario: Missing
474
491
  Given missing
475
492
 
493
+ # Scenario comment
476
494
  @three
477
495
  Scenario: Passing
478
496
  Given passing
@@ -0,0 +1,92 @@
1
+ @in_progress
2
+ Feature: DRb Server Integration
3
+ To prevent waiting for Rails and other large Ruby applications to load their environments
4
+ for each feature run Cucumber ships with a DRb client that can speak to a server which
5
+ loads up the environment only once.
6
+
7
+ Background: App with Spork support
8
+ Spork is a gem that has a DRb server and the scenarios below use illustarate how to use it.
9
+ However, any DRb server that adheres to the protocol that the client expects would work.
10
+
11
+ Given a standard Cucumber project directory structure
12
+ And a file named "features/support/env.rb" with:
13
+ """
14
+ require 'rubygems'
15
+ require 'spork'
16
+
17
+ Spork.prefork do
18
+ puts "I'm loading all the heavy stuff..."
19
+ end
20
+
21
+ Spork.each_run do
22
+ puts "I'm loading the stuff just for this run..."
23
+ end
24
+ """
25
+ And a file named "features/sample.feature" with:
26
+ """
27
+ Feature: Sample
28
+ Scenario: this is a test
29
+ Given I am just testing stuff
30
+ """
31
+ And a file named "features/step_definitions/all_your_steps_are_belong_to_us.rb" with:
32
+ """
33
+ Given /^I am just testing stuff$/ do
34
+ # no-op
35
+ end
36
+ """
37
+
38
+ Scenario: Feature Run with --drb flag
39
+ Given I am running "spork cuc" in the background
40
+
41
+ When I run cucumber features/sample.feature --drb
42
+ Then it should pass
43
+ And the output should contain
44
+ """
45
+ 1 step (1 passed)
46
+ """
47
+ And the output should contain
48
+ """
49
+ I'm loading the stuff just for this run...
50
+ """
51
+ And the output should not contain
52
+ """
53
+ I'm loading all the heavy stuff...
54
+ """
55
+
56
+
57
+ Scenario: Feature Run with --drb flag with no DRb server running
58
+ Cucumber will fall back on running the features locally in this case.
59
+
60
+ Given I am not running a DRb server in the background
61
+
62
+ When I run cucumber features/sample.feature --drb
63
+ Then it should pass
64
+ And STDERR should match
65
+ """
66
+ No DRb server is running. Running features locally:
67
+ """
68
+ And the output should contain
69
+ """
70
+ I'm loading all the heavy stuff...
71
+ I'm loading the stuff just for this run...
72
+ """
73
+
74
+ Scenario: Feature Run with --drb flag *defined in a profile* with no DRb server running
75
+
76
+ Given I am not running a DRb server in the background
77
+ And the following profile is defined:
78
+ """
79
+ server: --drb features
80
+ """
81
+
82
+ When I run cucumber --profile server
83
+ Then it should pass
84
+ And STDERR should match
85
+ """
86
+ No DRb server is running. Running features locally:
87
+ """
88
+ And the output should contain
89
+ """
90
+ I'm loading all the heavy stuff...
91
+ I'm loading the stuff just for this run...
92
+ """