cucumber 0.8.3 → 0.8.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (119) hide show
  1. data/Caliper.yml +0 -1
  2. data/History.txt +9 -0
  3. data/Rakefile +3 -3
  4. data/VERSION.yml +1 -1
  5. data/cucumber.gemspec +93 -106
  6. data/examples/python/README.textile +7 -0
  7. data/examples/rspec_doubles/features/mocking.feature +9 -0
  8. data/examples/rspec_doubles/features/step_definitions/calvin_steps.rb +19 -0
  9. data/examples/rspec_doubles/features/support/env.rb +12 -0
  10. data/examples/ruby2python/README.textile +7 -0
  11. data/examples/watir/features/search.feature +1 -1
  12. data/examples/webrat/features/search.feature +1 -1
  13. data/examples/webrat/features/support/env.rb +2 -2
  14. data/features/background.feature +1 -1
  15. data/features/cucumber_cli.feature +23 -90
  16. data/features/{cucumber_cli_diff_disabled.feature → diffing.feature} +1 -6
  17. data/features/html_formatter.feature +2 -2
  18. data/features/html_formatter/a.html +1 -6
  19. data/features/json_formatter.feature +1 -1
  20. data/features/junit_formatter.feature +5 -5
  21. data/features/language_help.feature +1 -0
  22. data/features/step_definitions/cucumber_steps.rb +2 -2
  23. data/features/support/env.rb +11 -7
  24. data/{examples → fixtures}/json/features/background.feature +0 -0
  25. data/{examples → fixtures}/json/features/embed.feature +0 -0
  26. data/{examples → fixtures}/json/features/one_passing_one_failing.feature +0 -0
  27. data/{examples → fixtures}/json/features/pystring.feature +0 -0
  28. data/{examples → fixtures}/json/features/step_definitions/steps.rb +0 -0
  29. data/{examples → fixtures}/json/features/tables.feature +0 -0
  30. data/{examples → fixtures}/junit/features/one_passing_one_failing.feature +0 -0
  31. data/{examples → fixtures}/junit/features/pending.feature +0 -0
  32. data/{examples → fixtures}/junit/features/step_definitions/steps.rb +0 -0
  33. data/{examples → fixtures}/self_test/.gitignore +0 -0
  34. data/{examples → fixtures}/self_test/README.textile +0 -0
  35. data/{examples → fixtures}/self_test/Rakefile +0 -0
  36. data/{examples → fixtures}/self_test/features/background/background_tagged_before_on_outline.feature +0 -0
  37. data/{examples → fixtures}/self_test/features/background/background_with_name.feature +0 -0
  38. data/{examples → fixtures}/self_test/features/background/failing_background.feature +0 -0
  39. data/{examples → fixtures}/self_test/features/background/failing_background_after_success.feature +0 -0
  40. data/{examples → fixtures}/self_test/features/background/multiline_args_background.feature +0 -0
  41. data/{examples → fixtures}/self_test/features/background/passing_background.feature +0 -0
  42. data/{examples → fixtures}/self_test/features/background/pending_background.feature +0 -0
  43. data/{examples → fixtures}/self_test/features/background/scenario_outline_failing_background.feature +0 -0
  44. data/{examples → fixtures}/self_test/features/background/scenario_outline_passing_background.feature +0 -0
  45. data/{examples → fixtures}/self_test/features/call_undefined_step_from_step_def.feature +0 -0
  46. data/{examples → fixtures}/self_test/features/failing_expectation.feature +0 -0
  47. data/{examples → fixtures}/self_test/features/lots_of_undefined.feature +0 -0
  48. data/{examples → fixtures}/self_test/features/multiline_name.feature +0 -0
  49. data/{examples → fixtures}/self_test/features/outline_sample.feature +0 -0
  50. data/{examples → fixtures}/self_test/features/sample.feature +0 -0
  51. data/{examples → fixtures}/self_test/features/search_sample.feature +0 -0
  52. data/{examples → fixtures}/self_test/features/step_definitions/sample_steps.rb +0 -0
  53. data/{examples → fixtures}/self_test/features/support/env.rb +0 -0
  54. data/{examples → fixtures}/self_test/features/tags_sample.feature +0 -0
  55. data/{examples → fixtures}/self_test/features/tons_of_cukes.feature +0 -0
  56. data/{examples → fixtures}/self_test/features/undefined_multiline_args.feature +0 -0
  57. data/{examples → fixtures}/self_test/list-of-features.txt +0 -0
  58. data/{examples → fixtures}/steps_library/features/step_definitions/steps_lib1.rb +0 -0
  59. data/{examples → fixtures}/steps_library/features/step_definitions/steps_lib2.rb +0 -0
  60. data/{examples → fixtures}/tickets/Rakefile +0 -0
  61. data/{examples → fixtures}/tickets/features.html +0 -0
  62. data/{examples → fixtures}/tickets/features/172.feature +0 -0
  63. data/{examples → fixtures}/tickets/features/177/1.feature +0 -0
  64. data/{examples → fixtures}/tickets/features/177/2.feature +0 -0
  65. data/{examples → fixtures}/tickets/features/177/3.feature +0 -0
  66. data/{examples → fixtures}/tickets/features/180.feature +0 -0
  67. data/{examples → fixtures}/tickets/features/229/tagged_hooks.feature +0 -0
  68. data/{examples → fixtures}/tickets/features/229/tagged_hooks.rb +0 -0
  69. data/{examples → fixtures}/tickets/features/236.feature +0 -0
  70. data/{examples → fixtures}/tickets/features/241.feature +0 -0
  71. data/{examples → fixtures}/tickets/features/246.feature +0 -0
  72. data/{examples → fixtures}/tickets/features/248.feature +0 -0
  73. data/{examples → fixtures}/tickets/features/270/back.feature +0 -0
  74. data/{examples → fixtures}/tickets/features/270/back.steps.rb +0 -0
  75. data/{examples → fixtures}/tickets/features/272/hooks.feature +0 -0
  76. data/{examples → fixtures}/tickets/features/272/hooks_steps.rb +0 -0
  77. data/{examples → fixtures}/tickets/features/279/py_string_indent.feature +0 -0
  78. data/{examples → fixtures}/tickets/features/279/py_string_indent.steps.rb +0 -0
  79. data/{examples → fixtures}/tickets/features/279/wrong.feature_ +0 -0
  80. data/{examples → fixtures}/tickets/features/301/filter_background_tagged_hooks.feature +0 -0
  81. data/{examples → fixtures}/tickets/features/301/filter_background_tagged_hooks_steps.rb +0 -0
  82. data/{examples → fixtures}/tickets/features/306/only_background.feature +0 -0
  83. data/{examples → fixtures}/tickets/features/around_timeout.feature +0 -0
  84. data/{examples → fixtures}/tickets/features/half_manual.feature +0 -0
  85. data/{examples → fixtures}/tickets/features/lib/eatting_machine.rb +0 -0
  86. data/{examples → fixtures}/tickets/features/lib/pantry.rb +0 -0
  87. data/{examples → fixtures}/tickets/features/scenario_outline.feature +0 -0
  88. data/{examples → fixtures}/tickets/features/step_definitons/246_steps.rb +0 -0
  89. data/{examples → fixtures}/tickets/features/step_definitons/248_steps.rb +0 -0
  90. data/{examples → fixtures}/tickets/features/step_definitons/around_timeout_steps.rb +0 -0
  91. data/{examples → fixtures}/tickets/features/step_definitons/half_manual_steps.rb +0 -0
  92. data/{examples → fixtures}/tickets/features/step_definitons/scenario_outline_steps.rb +0 -0
  93. data/{examples → fixtures}/tickets/features/step_definitons/tickets_steps.rb +0 -0
  94. data/{examples → fixtures}/tickets/features/table_diffing.feature +0 -0
  95. data/{examples → fixtures}/tickets/features/tickets.feature +0 -0
  96. data/gem_tasks/examples.rake +1 -1
  97. data/lib/cucumber/ast/feature.rb +0 -5
  98. data/lib/cucumber/ast/feature_element.rb +2 -6
  99. data/lib/cucumber/ast/features.rb +0 -5
  100. data/lib/cucumber/ast/table.rb +1 -4
  101. data/lib/cucumber/ast/tags.rb +2 -2
  102. data/lib/cucumber/cli/configuration.rb +2 -2
  103. data/lib/cucumber/cli/drb_client.rb +1 -1
  104. data/lib/cucumber/cli/main.rb +1 -17
  105. data/lib/cucumber/cli/options.rb +0 -1
  106. data/lib/cucumber/cli/profile_loader.rb +1 -1
  107. data/lib/cucumber/feature_file.rb +9 -11
  108. data/lib/cucumber/formatter/console.rb +0 -11
  109. data/lib/cucumber/formatter/json.rb +1 -1
  110. data/lib/cucumber/formatter/pretty.rb +0 -1
  111. data/lib/cucumber/formatter/progress.rb +0 -1
  112. data/lib/cucumber/parser/gherkin_builder.rb +34 -28
  113. data/lib/cucumber/rspec/doubles.rb +16 -0
  114. data/lib/cucumber/step_mother.rb +37 -31
  115. data/spec/cucumber/cli/configuration_spec.rb +2 -2
  116. data/spec/cucumber/formatter/spec_helper.rb +1 -1
  117. metadata +96 -109
  118. data/examples/dos_line_endings/Rakefile +0 -6
  119. data/examples/dos_line_endings/features/dos_line_endings.feature +0 -9
@@ -1,12 +1,12 @@
1
1
  require 'webrat'
2
- require 'spec'
2
+ require 'rspec'
3
3
 
4
4
  Webrat.configure do |config|
5
5
  config.mode = :mechanize
6
6
  end
7
7
 
8
8
  class WebratWorld
9
- include Spec::Matchers
9
+ include RSpec::Matchers
10
10
  include Webrat::Methods
11
11
  include Webrat::Matchers
12
12
  end
@@ -119,7 +119,7 @@ Feature: backgrounds
119
119
  6 steps (1 failed, 5 skipped)
120
120
 
121
121
  """
122
- And "examples/self_test/tmp/after.txt" should exist
122
+ And "fixtures/self_test/tmp/after.txt" should exist
123
123
 
124
124
  Scenario: run a feature with scenario outlines that has a background that fails
125
125
  When I run cucumber -q features/background/scenario_outline_failing_background.feature --require features
@@ -167,37 +167,6 @@ Feature: Cucumber command line
167
167
 
168
168
  """
169
169
 
170
- Scenario: Run Norwegian
171
- Given I am in i18n/no
172
- When I run cucumber -q features
173
- Then STDERR should be empty
174
- Then it should pass with
175
- """
176
- # language: no
177
- Egenskap: Summering
178
- For å slippe å gjøre dumme feil
179
- Som en regnskapsfører
180
- Vil jeg kunne legge sammen
181
-
182
- Scenario: to tall
183
- Gitt at jeg har tastet inn 5
184
- Og at jeg har tastet inn 7
185
- Når jeg summerer
186
- Så skal resultatet være 12
187
-
188
- @iterasjon3
189
- Scenario: tre tall
190
- Gitt at jeg har tastet inn 5
191
- Og at jeg har tastet inn 7
192
- Og at jeg har tastet inn 1
193
- Når jeg summerer
194
- Så skal resultatet være 13
195
-
196
- 2 scenarios (2 passed)
197
- 9 steps (9 passed)
198
-
199
- """
200
-
201
170
  Scenario: --dry-run
202
171
  When I run cucumber --dry-run --no-source features/*.feature --tags ~@lots
203
172
  Then it should pass with
@@ -370,7 +339,7 @@ Feature: Cucumber command line
370
339
  Scenario: Multiple formatters and outputs
371
340
  When I run cucumber --format progress --out tmp/progress.txt --format pretty --out tmp/pretty.txt --no-source --dry-run features/lots_of_undefined.feature
372
341
  Then STDERR should be empty
373
- Then "examples/self_test/tmp/progress.txt" should contain
342
+ Then "fixtures/self_test/tmp/progress.txt" should contain
374
343
  """
375
344
  UUUUU
376
345
 
@@ -378,7 +347,7 @@ Feature: Cucumber command line
378
347
  5 steps (5 undefined)
379
348
 
380
349
  """
381
- And "examples/self_test/tmp/pretty.txt" should contain
350
+ And "fixtures/self_test/tmp/pretty.txt" should contain
382
351
  """
383
352
  Feature: Lots of undefined
384
353
 
@@ -528,70 +497,34 @@ Feature: Cucumber command line
528
497
 
529
498
  Scenario: Run with limited tag count, blowing it on scenario
530
499
  When I run cucumber -q features/tags_sample.feature --no-source --dry-run --tags @sample_three:1
531
- Then it should fail with
532
- """
533
- @sample_one
534
- Feature: Tag samples
535
-
536
- @sample_three
537
- Scenario Outline:
538
- Given <state>
539
-
540
- Examples:
541
- | state |
542
- | missing |
543
-
544
- @sample_three @sample_four
545
- Scenario: Skipped
546
- Given missing
547
-
548
- 2 scenarios (2 undefined)
549
- 2 steps (2 undefined)
550
-
551
- @sample_three occurred 2 times, but the limit was set to 1
552
- features/tags_sample.feature:9
553
- features/tags_sample.feature:16
554
-
555
- """
500
+ Then it should fail with
501
+ """
502
+ @sample_three occurred 2 times, but the limit was set to 1
503
+ features/tags_sample.feature:11
504
+ features/tags_sample.feature:16
505
+ """
556
506
 
557
507
  Scenario: Run with limited tag count, blowing it via feature inheritance
558
508
  When I run cucumber -q features/tags_sample.feature --no-source --dry-run --tags @sample_one:1
559
- Then STDERR should be empty
560
509
  Then it should fail with
561
- """
562
- @sample_one
563
- Feature: Tag samples
564
-
565
- @sample_two @sample_four
566
- Scenario: Passing
567
- Given missing
568
-
569
- @sample_three
570
- Scenario Outline:
571
- Given <state>
572
-
573
- Examples:
574
- | state |
575
- | missing |
576
-
577
- @sample_three @sample_four
578
- Scenario: Skipped
579
- Given missing
580
-
581
- 3 scenarios (3 undefined)
582
- 3 steps (3 undefined)
583
-
584
- @sample_one occurred 3 times, but the limit was set to 1
585
- features/tags_sample.feature:5
586
- features/tags_sample.feature:9
587
- features/tags_sample.feature:16
588
-
589
- """
510
+ """
511
+ @sample_one occurred 3 times, but the limit was set to 1
512
+ features/tags_sample.feature:5
513
+ features/tags_sample.feature:11
514
+ features/tags_sample.feature:16
515
+ """
516
+
517
+ Scenario: Run with limited tag count using negative tag, blowing it via a tag that is not run
518
+ When I run cucumber -q features/tags_sample.feature --no-source --dry-run --tags ~@sample_one:1
519
+ Then it should fail with
520
+ """
521
+ @sample_one occurred 3 times, but the limit was set to 1
522
+ """
590
523
 
591
524
  Scenario: Reformat files with --autoformat
592
525
  When I run cucumber --autoformat tmp/formatted features
593
526
  Then STDERR should be empty
594
- Then "examples/self_test/tmp/formatted/features/sample.feature" should contain
527
+ Then "fixtures/self_test/tmp/formatted/features/sample.feature" should contain
595
528
  """
596
529
  # Feature comment
597
530
  @one
@@ -623,7 +556,7 @@ Feature: Cucumber command line
623
556
  Scenario: Generate PDF with pdf formatter
624
557
  When I run cucumber --format pdf --out tmp/sample.pdf --dry-run features/sample.feature
625
558
  Then STDERR should be empty
626
- Then "examples/self_test/tmp/sample.pdf" should match "Pages 2"
559
+ Then "fixtures/self_test/tmp/sample.pdf" should match "Pages 2"
627
560
 
628
561
  Scenario: Run feature elements which match a name using -n
629
562
  When I run cucumber -n Pisang -q features/
@@ -12,12 +12,7 @@ Feature: Cucumber command line
12
12
  Scenario: Failing expectation
13
13
  Given failing expectation
14
14
  expected: "that",
15
- got: "this" (using ==)
16
- Diff:
17
- @@ -1,2 +1,2 @@
18
- -that
19
- +this
20
- (RSpec::Expectations::ExpectationNotMetError)
15
+ got: "this" (using ==) (RSpec::Expectations::ExpectationNotMetError)
21
16
  ./features/step_definitions/sample_steps.rb:63:in `/^failing expectation$/'
22
17
  features/failing_expectation.feature:4:in `Given failing expectation'
23
18
 
@@ -3,6 +3,6 @@ Feature: HTML formatter
3
3
  In order to make it easy to read Cucumber results
4
4
  there should be a HTML formatter with an awesome CSS
5
5
 
6
- Scenario: Everything in examples/self_test
6
+ Scenario: Everything in fixtures/self_test
7
7
  When I run cucumber -q --format html --out tmp/a.html features
8
- Then "examples/self_test/tmp/a.html" should have the same contents as "features/html_formatter/a.html"
8
+ Then "fixtures/self_test/tmp/a.html" should have the same contents as "features/html_formatter/a.html"
@@ -508,12 +508,7 @@ features/call_undefined_step_from_step_def.feature:7:in `Given call step "a step
508
508
  <span class="linenum">20</span><span class="keyword">end</span></code></pre><pre>Given /^$/ do
509
509
  pending # express the regexp above with the code you wish you had
510
510
  end</pre></li> <script type="text/javascript">moveProgressBar('38.4');</script></ol></div></div><div class="feature"><h2><span class="val">Feature: Failing expectation</span></h2><p class="narrative"></p><div class='scenario'><h3 id="scenario_19"><span class="keyword">Scenario:</span> <span class="val">Failing expectation</span></h3><ol><script>makeRed('scenario_19');</script><li id='features_failing_expectation_feature_4' class='step failed'><div class="step_name"><span class="keyword">Given </span><span class="step val">failing expectation</span></div><div class="step_file"><span>features/step_definitions/sample_steps.rb:62</span></div><div class="message"><pre>expected: "that",
511
- got: "this" (using ==)
512
- Diff:
513
- @@ -1,2 +1,2 @@
514
- -that
515
- +this
516
- </pre></div><div class="backtrace"><pre>./features/step_definitions/sample_steps.rb:63:in `/^failing expectation$/'
511
+ got: "this" (using ==)</pre></div><div class="backtrace"><pre>./features/step_definitions/sample_steps.rb:63:in `/^failing expectation$/'
517
512
  features/failing_expectation.feature:4:in `Given failing expectation':in `/^failing expectation$/'
518
513
  ./features/step_definitions/sample_steps.rb:63:in `/^failing expectation$/'
519
514
  features/failing_expectation.feature:4:in `Given failing expectation':in `Given failing expectation'</pre></div><pre class="ruby"><code><span class="linenum">61</span>
@@ -13,7 +13,7 @@ Feature: JSON output formatter
13
13
  And it should fail with
14
14
  """
15
15
  """
16
- And "examples/json/tmp/out.json" should match "^\{\"features\":\["
16
+ And "fixtures/json/tmp/out.json" should match "^\{\"features\":\["
17
17
 
18
18
  Scenario: one feature, one passing scenario, one failing scenario
19
19
  When I run cucumber --format json_pretty features/one_passing_one_failing.feature
@@ -12,7 +12,7 @@ Feature: JUnit output formatter
12
12
  """
13
13
 
14
14
  """
15
- And "examples/junit/tmp/TEST-one_passing_one_failing.xml" with junit duration "0.005" should contain
15
+ And "fixtures/junit/tmp/TEST-one_passing_one_failing.xml" with junit duration "0.005" should contain
16
16
  """
17
17
  <?xml version="1.0" encoding="UTF-8"?>
18
18
  <testsuite errors="0" failures="1" name="One passing scenario, one failing scenario" tests="2" time="0.005">
@@ -38,7 +38,7 @@ Feature: JUnit output formatter
38
38
  """
39
39
 
40
40
  """
41
- And "examples/junit/tmp/TEST-pending.xml" with junit duration "0.009" should contain
41
+ And "fixtures/junit/tmp/TEST-pending.xml" with junit duration "0.009" should contain
42
42
  """
43
43
  <?xml version="1.0" encoding="UTF-8"?>
44
44
  <testsuite errors="0" failures="0" name="Pending step" tests="0" time="0.009">
@@ -52,7 +52,7 @@ Feature: JUnit output formatter
52
52
  """
53
53
 
54
54
  """
55
- And "examples/junit/tmp/TEST-pending.xml" with junit duration "0.000160" should contain
55
+ And "fixtures/junit/tmp/TEST-pending.xml" with junit duration "0.000160" should contain
56
56
  """
57
57
  <?xml version="1.0" encoding="UTF-8"?>
58
58
  <testsuite errors="0" failures="1" name="Pending step" tests="1" time="0.000160">
@@ -73,8 +73,8 @@ Feature: JUnit output formatter
73
73
  """
74
74
 
75
75
  """
76
- And "examples/junit/tmp/TEST-one_passing_one_failing.xml" should exist
77
- And "examples/junit/tmp/TEST-pending.xml" should exist
76
+ And "fixtures/junit/tmp/TEST-one_passing_one_failing.xml" should exist
77
+ And "fixtures/junit/tmp/TEST-pending.xml" should exist
78
78
 
79
79
  Scenario: show correct error message if no --out is passed
80
80
  When I run cucumber --format junit features
@@ -40,6 +40,7 @@ Feature: Language help
40
40
  | en-Scouse | Scouse | Scouse |
41
41
  | en-au | Australian | Australian |
42
42
  | en-lol | LOLCAT | LOLCAT |
43
+ | en-pirate | Pirate | Pirate |
43
44
  | en-tx | Texan | Texan |
44
45
  | eo | Esperanto | Esperanto |
45
46
  | es | Spanish | español |
@@ -2,7 +2,7 @@
2
2
  require 'tempfile'
3
3
 
4
4
  Given /^I am in (.*)$/ do |example_dir_relative_path|
5
- @current_dir = examples_dir(example_dir_relative_path)
5
+ @current_dir = fixtures_dir(example_dir_relative_path)
6
6
  end
7
7
 
8
8
  Given /^a standard Cucumber project directory structure$/ do
@@ -68,7 +68,7 @@ Then /^it should (fail|pass)$/ do |success|
68
68
  end
69
69
 
70
70
  Then /^it should (fail|pass) with$/ do |success, output|
71
- last_stdout.should == output
71
+ combined_output.should =~ Regexp.compile(Regexp.escape(output))
72
72
  Then("it should #{success}")
73
73
  end
74
74
 
@@ -11,19 +11,19 @@ require 'cucumber/formatter/unicode'
11
11
 
12
12
  class CucumberWorld
13
13
  extend Forwardable
14
- def_delegators CucumberWorld, :examples_dir, :self_test_dir, :working_dir, :cucumber_lib_dir
14
+ def_delegators CucumberWorld, :fixtures_dir, :self_test_dir, :working_dir, :cucumber_lib_dir
15
15
 
16
- def self.examples_dir(subdir=nil)
17
- @examples_dir ||= File.expand_path(File.join(File.dirname(__FILE__), '../../examples'))
18
- subdir ? File.join(@examples_dir, subdir) : @examples_dir
16
+ def self.fixtures_dir(subdir=nil)
17
+ @fixtures_dir ||= File.expand_path(File.join(File.dirname(__FILE__), '../../fixtures'))
18
+ subdir ? File.join(@fixtures_dir, subdir) : @fixtures_dir
19
19
  end
20
20
 
21
21
  def self.self_test_dir
22
- @self_test_dir ||= examples_dir('self_test')
22
+ @self_test_dir ||= fixtures_dir('self_test')
23
23
  end
24
24
 
25
25
  def self.working_dir
26
- @working_dir ||= examples_dir('self_test/tmp')
26
+ @working_dir ||= fixtures_dir('self_test/tmp')
27
27
  end
28
28
 
29
29
  def cucumber_lib_dir
@@ -42,12 +42,16 @@ class CucumberWorld
42
42
  strip_1_9_paths(strip_duration(@last_stdout))
43
43
  end
44
44
 
45
+ def combined_output
46
+ last_stdout + "\n" + last_stderr
47
+ end
48
+
45
49
  def strip_duration(s)
46
50
  s.gsub(/^\d+m\d+\.\d+s\n/m, "")
47
51
  end
48
52
 
49
53
  def strip_1_9_paths(s)
50
- s.gsub(/#{Dir.pwd}\/examples\/self_test\/tmp/m, ".").gsub(/#{Dir.pwd}\/examples\/self_test/m, ".")
54
+ s.gsub(/#{Dir.pwd}\/fixtures\/self_test\/tmp/m, ".").gsub(/#{Dir.pwd}\/fixtures\/self_test/m, ".")
51
55
  end
52
56
 
53
57
  def replace_duration(s, replacement)
File without changes