cucumber 1.2.1 → 1.2.2

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 (172) hide show
  1. data/.rvmrc +1 -1
  2. data/.travis.yml +3 -2
  3. data/DEVELOPERS.md +48 -0
  4. data/History.md +22 -3
  5. data/README.md +13 -31
  6. data/Rakefile +1 -0
  7. data/cucumber.gemspec +18 -17
  8. data/cucumber.yml +3 -2
  9. data/examples/i18n/cs/Rakefile +6 -0
  10. data/examples/i18n/cs/features/addition.feature +17 -0
  11. data/examples/i18n/cs/features/division.feature +11 -0
  12. data/examples/i18n/cs/features/step_definitons/calculator_steps.rb +24 -0
  13. data/examples/i18n/cs/lib/calculator.rb +14 -0
  14. data/examples/i18n/hi/Rakefile +6 -0
  15. data/examples/i18n/hi/features/addition.feature +16 -0
  16. data/examples/i18n/hi/features/division.feature +10 -0
  17. data/examples/i18n/hi/features/step_definitons/calculator_steps.rb +24 -0
  18. data/examples/i18n/hi/lib/calculator.rb +15 -0
  19. data/examples/python/README.textile +2 -1
  20. data/examples/ruby2python/README.textile +2 -1
  21. data/features/.cucumber/stepdefs.json +1688 -445
  22. data/features/assertions.feature +69 -0
  23. data/features/formatter_callbacks.feature +189 -0
  24. data/features/html_formatter.feature +19 -0
  25. data/features/json_formatter.feature +8 -4
  26. data/features/nested_steps_with_second_arg.feature +73 -0
  27. data/features/step_definitions.feature +65 -0
  28. data/features/step_definitions/cucumber_steps.rb +18 -3
  29. data/fixtures/self_test/features/support/env.rb +1 -1
  30. data/gem_tasks/cucumber.rake +5 -3
  31. data/gem_tasks/downloads.rb +3 -3
  32. data/gem_tasks/stats +4 -2
  33. data/gem_tasks/yard.rake +31 -13
  34. data/legacy_features/default_snippets.feature +3 -3
  35. data/legacy_features/language_help.feature +4 -0
  36. data/legacy_features/report_called_undefined_steps.feature +1 -1
  37. data/legacy_features/snippet.feature +3 -3
  38. data/legacy_features/snippets_when_using_star_keyword.feature +1 -1
  39. data/legacy_features/step_definitions/cucumber_steps.rb +4 -3
  40. data/legacy_features/support/env.rb +1 -1
  41. data/legacy_features/support/fake_wire_server.rb +9 -9
  42. data/lib/autotest/cucumber_mixin.rb +14 -14
  43. data/lib/autotest/discover.rb +2 -0
  44. data/lib/cucumber.rb +2 -2
  45. data/lib/cucumber/ast.rb +1 -1
  46. data/lib/cucumber/ast/background.rb +11 -7
  47. data/lib/cucumber/ast/comment.rb +2 -2
  48. data/lib/cucumber/ast/doc_string.rb +1 -1
  49. data/lib/cucumber/ast/examples.rb +1 -1
  50. data/lib/cucumber/ast/feature.rb +2 -2
  51. data/lib/cucumber/ast/feature_element.rb +1 -1
  52. data/lib/cucumber/ast/multiline_argument.rb +2 -2
  53. data/lib/cucumber/ast/names.rb +2 -2
  54. data/lib/cucumber/ast/outline_table.rb +4 -5
  55. data/lib/cucumber/ast/scenario.rb +14 -14
  56. data/lib/cucumber/ast/scenario_outline.rb +4 -4
  57. data/lib/cucumber/ast/step.rb +3 -3
  58. data/lib/cucumber/ast/step_collection.rb +5 -5
  59. data/lib/cucumber/ast/step_invocation.rb +8 -8
  60. data/lib/cucumber/ast/table.rb +40 -27
  61. data/lib/cucumber/ast/tree_walker.rb +9 -8
  62. data/lib/cucumber/ast/visitor.rb +1 -1
  63. data/lib/cucumber/cli/configuration.rb +10 -10
  64. data/lib/cucumber/cli/drb_client.rb +1 -1
  65. data/lib/cucumber/cli/main.rb +3 -3
  66. data/lib/cucumber/cli/options.rb +3 -2
  67. data/lib/cucumber/cli/profile_loader.rb +1 -1
  68. data/lib/cucumber/configuration.rb +12 -12
  69. data/lib/cucumber/constantize.rb +11 -2
  70. data/lib/cucumber/core_ext/disable_mini_and_test_unit_autorun.rb +1 -1
  71. data/lib/cucumber/core_ext/instance_exec.rb +4 -4
  72. data/lib/cucumber/core_ext/proc.rb +3 -3
  73. data/lib/cucumber/errors.rb +1 -1
  74. data/lib/cucumber/feature_file.rb +1 -1
  75. data/lib/cucumber/formatter/ansicolor.rb +36 -23
  76. data/lib/cucumber/formatter/console.rb +45 -25
  77. data/lib/cucumber/formatter/debug.rb +7 -7
  78. data/lib/cucumber/formatter/duration.rb +1 -1
  79. data/lib/cucumber/formatter/gherkin_formatter_adapter.rb +7 -0
  80. data/lib/cucumber/formatter/gpretty.rb +1 -1
  81. data/lib/cucumber/formatter/html.rb +52 -53
  82. data/lib/cucumber/formatter/interceptor.rb +2 -2
  83. data/lib/cucumber/formatter/json.rb +1 -1
  84. data/lib/cucumber/formatter/json_pretty.rb +2 -1
  85. data/lib/cucumber/formatter/junit.rb +1 -1
  86. data/lib/cucumber/formatter/ordered_xml_markup.rb +1 -1
  87. data/lib/cucumber/formatter/pretty.rb +12 -12
  88. data/lib/cucumber/formatter/progress.rb +5 -5
  89. data/lib/cucumber/formatter/rerun.rb +5 -5
  90. data/lib/cucumber/formatter/stepdefs.rb +1 -1
  91. data/lib/cucumber/formatter/steps.rb +6 -6
  92. data/lib/cucumber/formatter/summary.rb +6 -6
  93. data/lib/cucumber/formatter/unicode.rb +18 -18
  94. data/lib/cucumber/formatter/usage.rb +7 -7
  95. data/lib/cucumber/js_support/js_dsl.js +1 -1
  96. data/lib/cucumber/language_support.rb +1 -1
  97. data/lib/cucumber/parser/gherkin_builder.rb +33 -33
  98. data/lib/cucumber/platform.rb +3 -2
  99. data/lib/cucumber/py_support/py_dsl.py +2 -2
  100. data/lib/cucumber/py_support/py_language.py +2 -2
  101. data/lib/cucumber/py_support/py_language.rb +2 -2
  102. data/lib/cucumber/rake/task.rb +4 -3
  103. data/lib/cucumber/rb_support/rb_dsl.rb +10 -10
  104. data/lib/cucumber/rb_support/rb_language.rb +27 -19
  105. data/lib/cucumber/rb_support/rb_step_definition.rb +39 -11
  106. data/lib/cucumber/rb_support/rb_transform.rb +3 -3
  107. data/lib/cucumber/rb_support/rb_world.rb +15 -15
  108. data/lib/cucumber/rb_support/regexp_argument_matcher.rb +1 -1
  109. data/lib/cucumber/rspec/disable_option_parser.rb +1 -1
  110. data/lib/cucumber/rspec/doubles.rb +1 -1
  111. data/lib/cucumber/runtime.rb +11 -10
  112. data/lib/cucumber/runtime/features_loader.rb +6 -6
  113. data/lib/cucumber/runtime/for_programming_languages.rb +8 -15
  114. data/lib/cucumber/runtime/results.rb +6 -6
  115. data/lib/cucumber/runtime/support_code.rb +37 -28
  116. data/lib/cucumber/runtime/user_interface.rb +4 -4
  117. data/lib/cucumber/step_definition_light.rb +4 -4
  118. data/lib/cucumber/step_definitions.rb +2 -3
  119. data/lib/cucumber/step_match.rb +6 -6
  120. data/lib/cucumber/step_mother.rb +1 -1
  121. data/lib/cucumber/term/ansicolor.rb +22 -22
  122. data/lib/cucumber/wire_support/configuration.rb +11 -14
  123. data/lib/cucumber/wire_support/connection.rb +10 -9
  124. data/lib/cucumber/wire_support/request_handler.rb +3 -3
  125. data/lib/cucumber/wire_support/wire_exception.rb +3 -3
  126. data/lib/cucumber/wire_support/wire_language.rb +11 -11
  127. data/lib/cucumber/wire_support/wire_packet.rb +7 -5
  128. data/lib/cucumber/wire_support/wire_protocol.rb +6 -6
  129. data/lib/cucumber/wire_support/wire_protocol/requests.rb +20 -20
  130. data/lib/cucumber/wire_support/wire_step_definition.rb +4 -4
  131. data/spec/cucumber/ast/background_spec.rb +4 -4
  132. data/spec/cucumber/ast/doc_string_spec.rb +8 -8
  133. data/spec/cucumber/ast/feature_factory.rb +4 -4
  134. data/spec/cucumber/ast/feature_spec.rb +18 -18
  135. data/spec/cucumber/ast/outline_table_spec.rb +3 -3
  136. data/spec/cucumber/ast/step_spec.rb +4 -4
  137. data/spec/cucumber/ast/table_spec.rb +50 -29
  138. data/spec/cucumber/ast/tree_walker_spec.rb +12 -4
  139. data/spec/cucumber/broadcaster_spec.rb +1 -1
  140. data/spec/cucumber/cli/configuration_spec.rb +10 -4
  141. data/spec/cucumber/cli/drb_client_spec.rb +1 -1
  142. data/spec/cucumber/cli/main_spec.rb +28 -7
  143. data/spec/cucumber/cli/options_spec.rb +3 -3
  144. data/spec/cucumber/configuration_spec.rb +4 -4
  145. data/spec/cucumber/constantize_spec.rb +2 -0
  146. data/spec/cucumber/core_ext/proc_spec.rb +7 -7
  147. data/spec/cucumber/formatter/ansicolor_spec.rb +2 -2
  148. data/spec/cucumber/formatter/duration_spec.rb +2 -2
  149. data/spec/cucumber/formatter/html_spec.rb +31 -31
  150. data/spec/cucumber/formatter/interceptor_spec.rb +10 -0
  151. data/spec/cucumber/formatter/progress_spec.rb +1 -1
  152. data/spec/cucumber/formatter/spec_helper.rb +7 -7
  153. data/spec/cucumber/rake/forked_spec.rb +15 -2
  154. data/spec/cucumber/rake/rcov_spec.rb +2 -2
  155. data/spec/cucumber/rb_support/rb_language_spec.rb +34 -17
  156. data/spec/cucumber/rb_support/rb_step_definition_spec.rb +45 -35
  157. data/spec/cucumber/rb_support/rb_transform_spec.rb +3 -3
  158. data/spec/cucumber/runtime/for_programming_languages_spec.rb +31 -0
  159. data/spec/cucumber/runtime/results_spec.rb +5 -5
  160. data/spec/cucumber/runtime/support_code_spec.rb +13 -2
  161. data/spec/cucumber/runtime_spec.rb +7 -7
  162. data/spec/cucumber/step_match_spec.rb +2 -2
  163. data/spec/cucumber/wire_support/configuration_spec.rb +16 -6
  164. data/spec/cucumber/wire_support/connection_spec.rb +25 -11
  165. data/spec/cucumber/wire_support/wire_exception_spec.rb +3 -3
  166. data/spec/cucumber/wire_support/wire_language_spec.rb +3 -3
  167. data/spec/cucumber/wire_support/wire_packet_spec.rb +4 -4
  168. data/spec/cucumber/wire_support/wire_step_definition_spec.rb +1 -1
  169. data/spec/spec_helper.rb +2 -2
  170. metadata +98 -128
  171. data/legacy_features/html_formatter.feature +0 -8
  172. data/legacy_features/html_formatter/a.html +0 -561
@@ -6,7 +6,7 @@ module Cucumber
6
6
  @receiver = mock('receiver')
7
7
  @broadcaster = Broadcaster.new([@receiver])
8
8
  end
9
-
9
+
10
10
  it "should broadcast methods to registered objects" do
11
11
  @receiver.should_receive(:konbanwa).with('good evening')
12
12
  @broadcaster.konbanwa('good evening')
@@ -151,7 +151,7 @@ module Cli
151
151
  end
152
152
 
153
153
  it "parses ERB syntax in the cucumber.yml file" do
154
- given_cucumber_yml_defined_as({'default' => '<%="--require some_file"%>'})
154
+ given_cucumber_yml_defined_as 'default' => "<%= '--require some_file' %>"
155
155
 
156
156
  config.parse!([])
157
157
  config.options[:require].should include('some_file')
@@ -402,7 +402,7 @@ END_OF_MESSAGE
402
402
  ENV["RAILS_ENV"].should == "selenium"
403
403
  config.feature_files.should_not include('RAILS_ENV=selenium')
404
404
  end
405
-
405
+
406
406
  describe "#tag_expression" do
407
407
  include RSpec::WorkInProgress
408
408
 
@@ -420,13 +420,19 @@ END_OF_MESSAGE
420
420
  end
421
421
  end
422
422
  end
423
-
423
+
424
424
  describe "#dry_run?" do
425
425
  it "returns true when --dry-run was specified on in the arguments" do
426
426
  config.parse!(['--dry-run'])
427
427
  config.dry_run?.should be_true
428
428
  end
429
-
429
+
430
+ it "returns true when --dry-run was specified in yaml file" do
431
+ given_cucumber_yml_defined_as({'default' => '--dry-run'})
432
+ config.parse!([])
433
+ config.dry_run?.should be_true
434
+ end
435
+
430
436
  it "returns false by default" do
431
437
  config.parse!([])
432
438
  config.dry_run?.should be_false
@@ -38,7 +38,7 @@ module Cucumber
38
38
  end
39
39
 
40
40
  context "with $CUCUMBER_DRB set" do
41
- before do
41
+ before do
42
42
  @original_env = ENV['CUCUMBER_DRB']
43
43
  ENV['CUCUMBER_DRB'] = '90000'
44
44
  end
@@ -13,27 +13,27 @@ module Cucumber
13
13
  File.stub!(:exist?).and_return(false) # When Configuration checks for cucumber.yml
14
14
  Dir.stub!(:[]).and_return([]) # to prevent cucumber's features dir to being laoded
15
15
  end
16
-
16
+
17
17
  let(:args) { [] }
18
18
  let(:out_stream) { nil }
19
19
  let(:err_stream) { nil }
20
20
  subject { Main.new(args, out_stream, err_stream)}
21
-
21
+
22
22
  describe "#execute!" do
23
23
  context "passed an existing runtime" do
24
24
  let(:existing_runtime) { double('runtime').as_null_object }
25
-
25
+
26
26
  def do_execute
27
27
  subject.execute!(existing_runtime)
28
28
  end
29
-
29
+
30
30
  it "configures that runtime" do
31
31
  expected_configuration = double('Configuration', :drb? => false).as_null_object
32
32
  Configuration.stub!(:new => expected_configuration)
33
33
  existing_runtime.should_receive(:configure).with(expected_configuration)
34
34
  do_execute
35
35
  end
36
-
36
+
37
37
  it "uses that runtime for running and reporting results" do
38
38
  expected_results = double('results', :failure? => true)
39
39
  existing_runtime.should_receive(:run!)
@@ -41,6 +41,22 @@ module Cucumber
41
41
  do_execute.should == expected_results.failure?
42
42
  end
43
43
  end
44
+
45
+ context "interrupted with ctrl-c" do
46
+ after do
47
+ Cucumber.wants_to_quit = false
48
+ end
49
+
50
+ it "should register as a failure" do
51
+ results = double('results', :failure? => false)
52
+ runtime = Runtime.any_instance
53
+ runtime.stub(:run!)
54
+ runtime.stub(:results).and_return(results)
55
+
56
+ Cucumber.wants_to_quit = true
57
+ subject.execute!.should be_true
58
+ end
59
+ end
44
60
  end
45
61
 
46
62
  describe "verbose mode" do
@@ -73,8 +89,13 @@ module Cucumber
73
89
 
74
90
  f = stub('formatter').as_null_object
75
91
 
76
- Object.should_receive(:const_get).with('ZooModule').and_return(mock_module)
77
- mock_module.should_receive(:const_get).with('MonkeyFormatterClass').and_return(mock('formatter class', :new => f))
92
+ if Cucumber::RUBY_1_8_7
93
+ Object.should_receive(:const_get).with('ZooModule').and_return(mock_module)
94
+ mock_module.should_receive(:const_get).with('MonkeyFormatterClass').and_return(mock('formatter class', :new => f))
95
+ else
96
+ Object.should_receive(:const_get).with('ZooModule', false).and_return(mock_module)
97
+ mock_module.should_receive(:const_get).with('MonkeyFormatterClass', false).and_return(mock('formatter class', :new => f))
98
+ end
78
99
 
79
100
  cli.execute!
80
101
  end
@@ -338,20 +338,20 @@ module Cli
338
338
 
339
339
  end
340
340
 
341
- describe "dry-run" do
341
+ describe "dry-run" do
342
342
  it "should have the default value for snippets" do
343
343
  given_cucumber_yml_defined_as({'foo' => %w[--dry-run]})
344
344
  options.parse!(%w{--dry-run})
345
345
  options[:snippets].should == true
346
346
  end
347
347
 
348
- it "should set snippets to false when no-snippets provided after dry-run" do
348
+ it "should set snippets to false when no-snippets provided after dry-run" do
349
349
  given_cucumber_yml_defined_as({'foo' => %w[--dry-run --no-snippets]})
350
350
  options.parse!(%w{--dry-run --no-snippets})
351
351
  options[:snippets].should == false
352
352
  end
353
353
 
354
- it "should set snippets to false when no-snippets provided before dry-run" do
354
+ it "should set snippets to false when no-snippets provided before dry-run" do
355
355
  given_cucumber_yml_defined_as({'foo' => %w[--no-snippet --dry-run]})
356
356
  options.parse!(%w{--no-snippets --dry-run})
357
357
  options[:snippets].should == false
@@ -4,20 +4,20 @@ module Cucumber
4
4
  describe Configuration do
5
5
  describe ".default" do
6
6
  subject { Configuration.default }
7
-
7
+
8
8
  it "has an autoload_code_paths containing the standard support and step_definitions folders" do
9
9
  subject.autoload_code_paths.should include('features/support')
10
10
  subject.autoload_code_paths.should include('features/step_definitions')
11
11
  end
12
12
  end
13
-
13
+
14
14
  describe "with custom user options" do
15
15
  let(:user_options) { { :autoload_code_paths => ['foo/bar/baz'] } }
16
16
  subject { Configuration.new(user_options) }
17
-
17
+
18
18
  it "allows you to override the defaults" do
19
19
  subject.autoload_code_paths.should == ['foo/bar/baz']
20
20
  end
21
21
  end
22
22
  end
23
- end
23
+ end
@@ -1,5 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
+ module Html end
4
+
3
5
  module Cucumber
4
6
  describe Constantize do
5
7
  include Constantize
@@ -6,7 +6,7 @@ describe Proc do
6
6
  proc = lambda {|a,b|}
7
7
  proc.file_colon_line.should =~ /^spec\/cucumber\/core_ext\/proc_spec\.rb:6/
8
8
  end
9
-
9
+
10
10
  it "should raise ArityMismatchError for too many args (expecting 0)" do
11
11
  lambda {
12
12
  Object.new.cucumber_instance_exec(true, 'foo', 1) do
@@ -35,20 +35,20 @@ describe Proc do
35
35
  }.should raise_error(Cucumber::ArityMismatchError, "Your block takes 2 arguments, but the Regexp matched 1 argument.")
36
36
  end
37
37
 
38
- if Cucumber::RUBY_1_9
39
- it "should allow varargs (expecting 0+)" do
38
+ if Cucumber::RUBY_1_8_7
39
+ # Ruby 1.8
40
+ it "should not allow varargs 0+ because Ruby 1.8 reports same arity as with no args, so we can't really tell the difference." do
40
41
  lambda {
41
42
  Object.new.cucumber_instance_exec(true, 'foo', 1) do |*args|
42
43
  end
43
- }.should_not raise_error(Cucumber::ArityMismatchError)
44
+ }.should raise_error(Cucumber::ArityMismatchError, "Your block takes 0 arguments, but the Regexp matched 1 argument.")
44
45
  end
45
46
  else
46
- # Ruby 1.8
47
- it "should not allow varargs 0+ because Ruby 1.8 reports same arity as with no args, so we can't really tell the difference." do
47
+ it "should allow varargs (expecting 0+)" do
48
48
  lambda {
49
49
  Object.new.cucumber_instance_exec(true, 'foo', 1) do |*args|
50
50
  end
51
- }.should raise_error(Cucumber::ArityMismatchError, "Your block takes 0 arguments, but the Regexp matched 1 argument.")
51
+ }.should_not raise_error(Cucumber::ArityMismatchError)
52
52
  end
53
53
  end
54
54
 
@@ -5,7 +5,7 @@ module Cucumber
5
5
  module Formatter
6
6
  describe ANSIColor do
7
7
  include ANSIColor
8
-
8
+
9
9
  it "should wrap passed_param with bold green and reset to green" do
10
10
  passed_param("foo").should == "\e[32m\e[1mfoo\e[0m\e[0m\e[32m"
11
11
  end
@@ -21,7 +21,7 @@ module Cucumber
21
21
  it "should wrap comments in grey" do
22
22
  comment("foo").should == "\e[90mfoo\e[0m"
23
23
  end
24
-
24
+
25
25
  it "should not generate ansi codes when colors are disabled" do
26
26
  ::Cucumber::Term::ANSIColor.coloring = false
27
27
  passed("foo").should == "foo"
@@ -5,7 +5,7 @@ module Cucumber
5
5
  module Formatter
6
6
  describe Duration do
7
7
  include Duration
8
-
8
+
9
9
  it "should format ms" do
10
10
  format_duration(0.002103).should == '0m0.002s'
11
11
  end
@@ -19,4 +19,4 @@ module Cucumber
19
19
  end
20
20
  end
21
21
  end
22
- end
22
+ end
@@ -17,23 +17,23 @@ module Cucumber
17
17
  nodes.detect{ |node| node.text =~ regexp }
18
18
  end
19
19
  end
20
-
20
+
21
21
  before(:each) do
22
22
  @out = StringIO.new
23
23
  @formatter = Html.new(step_mother, @out, {})
24
24
  step_mother.visitor = @formatter
25
25
  end
26
-
26
+
27
27
  it "should not raise an error when visiting a blank feature name" do
28
28
  lambda { @formatter.feature_name("Feature", "") }.should_not raise_error
29
29
  end
30
-
30
+
31
31
  describe "given a single feature" do
32
32
  before(:each) do
33
33
  run_defined_feature
34
34
  @doc = Nokogiri.HTML(@out.string)
35
35
  end
36
-
36
+
37
37
  describe "basic feature" do
38
38
  define_feature <<-FEATURE
39
39
  Feature: Bananas
@@ -41,23 +41,23 @@ module Cucumber
41
41
  As a human
42
42
  I must eat bananas
43
43
  FEATURE
44
-
44
+
45
45
  it "should output a main container div" do
46
46
  @out.string.should =~ /\<div class="cucumber"\>/
47
47
  end
48
48
  end
49
-
49
+
50
50
  describe "with a comment" do
51
51
  define_feature <<-FEATURE
52
52
  # Healthy
53
53
  Feature: Foo
54
54
  FEATURE
55
-
55
+
56
56
  it { @out.string.should =~ /^\<!DOCTYPE/ }
57
57
  it { @out.string.should =~ /\<\/html\>$/ }
58
58
  it { @doc.should have_css_node('.feature .comment', /Healthy/) }
59
59
  end
60
-
60
+
61
61
  describe "with a tag" do
62
62
  define_feature <<-FEATURE
63
63
  @foo
@@ -66,7 +66,7 @@ module Cucumber
66
66
 
67
67
  it { @doc.should have_css_node('.feature .tag', /foo/) }
68
68
  end
69
-
69
+
70
70
  describe "with a narrative" do
71
71
  define_feature <<-FEATURE
72
72
  Feature: Bananas
@@ -78,18 +78,18 @@ module Cucumber
78
78
  it { @doc.should have_css_node('.feature h2', /Bananas/) }
79
79
  it { @doc.should have_css_node('.feature .narrative', /must eat bananas/) }
80
80
  end
81
-
81
+
82
82
  describe "with a background" do
83
83
  define_feature <<-FEATURE
84
84
  Feature: Bananas
85
-
85
+
86
86
  Background:
87
87
  Given there are bananas
88
88
  FEATURE
89
89
 
90
90
  it { @doc.should have_css_node('.feature .background', /there are bananas/) }
91
91
  end
92
-
92
+
93
93
  describe "with a scenario" do
94
94
  define_feature <<-FEATURE
95
95
  Feature: Banana party
@@ -101,14 +101,14 @@ module Cucumber
101
101
  it { @doc.should have_css_node('.feature h3', /Monkey eats banana/) }
102
102
  it { @doc.should have_css_node('.feature .scenario .step', /there are bananas/) }
103
103
  end
104
-
104
+
105
105
  describe "with a scenario outline" do
106
106
  define_feature <<-FEATURE
107
107
  Feature: Fud Pyramid
108
108
 
109
109
  Scenario Outline: Monkey eats a balanced diet
110
110
  Given there are <Things>
111
-
111
+
112
112
  Examples: Fruit
113
113
  | Things |
114
114
  | apples |
@@ -118,14 +118,14 @@ module Cucumber
118
118
  | broccoli |
119
119
  | carrots |
120
120
  FEATURE
121
-
121
+
122
122
  it { @doc.should have_css_node('.feature .scenario.outline h4', /Fruit/) }
123
123
  it { @doc.should have_css_node('.feature .scenario.outline h4', /Vegetables/) }
124
124
  it { @doc.css('.feature .scenario.outline h4').length.should == 2}
125
125
  it { @doc.should have_css_node('.feature .scenario.outline table', //) }
126
126
  it { @doc.should have_css_node('.feature .scenario.outline table td', /carrots/) }
127
127
  end
128
-
128
+
129
129
  describe "with a step with a py string" do
130
130
  define_feature <<-FEATURE
131
131
  Feature: Traveling circus
@@ -136,7 +136,7 @@ module Cucumber
136
136
  foo
137
137
  """
138
138
  FEATURE
139
-
139
+
140
140
  it { @doc.should have_css_node('.feature .scenario .val', /foo/) }
141
141
  end
142
142
 
@@ -150,10 +150,10 @@ module Cucumber
150
150
  | foo |
151
151
  | bar |
152
152
  FEATURE
153
-
153
+
154
154
  it { @doc.should have_css_node('.feature .scenario table td', /foo/) }
155
155
  end
156
-
156
+
157
157
  describe "with a table in the background and the scenario" do
158
158
  define_feature <<-FEATURE
159
159
  Feature: accountant monkey
@@ -167,10 +167,10 @@ module Cucumber
167
167
  | e | f |
168
168
  | g | h |
169
169
  FEATURE
170
-
170
+
171
171
  it { @doc.css('td').length.should == 8 }
172
172
  end
173
-
173
+
174
174
  describe "with a py string in the background and the scenario" do
175
175
  define_feature <<-FEATURE
176
176
  Feature: py strings
@@ -190,12 +190,12 @@ module Cucumber
190
190
  it { @doc.css('.feature .background pre.val').length.should == 1 }
191
191
  it { @doc.css('.feature .scenario pre.val').length.should == 1 }
192
192
  end
193
-
193
+
194
194
  describe "with a step that fails in the scenario" do
195
195
  define_steps do
196
196
  Given(/boo/) { raise StandardError, 'eek'.freeze }
197
197
  end
198
-
198
+
199
199
  define_feature(<<-FEATURE)
200
200
  Feature: Animal Cruelty
201
201
 
@@ -206,12 +206,12 @@ module Cucumber
206
206
  it { @doc.should have_css_node('.feature .scenario .step.failed .message', /eek/) }
207
207
  it { @doc.should have_css_node('.feature .scenario .step.failed .message', /StandardError/) }
208
208
  end
209
-
209
+
210
210
  describe "with a step that fails in the backgound" do
211
211
  define_steps do
212
212
  Given(/boo/) { raise 'eek' }
213
213
  end
214
-
214
+
215
215
  define_feature(<<-FEATURE)
216
216
  Feature: shouting
217
217
  Background:
@@ -219,7 +219,7 @@ module Cucumber
219
219
  Scenario:
220
220
  Given yay
221
221
  FEATURE
222
-
222
+
223
223
  it { @doc.should have_css_node('.feature .background .step.failed', /eek/) }
224
224
  it { @doc.should_not have_css_node('.feature .scenario .step.failed', //) }
225
225
  it { @doc.should have_css_node('.feature .scenario .step.undefined', /yay/) }
@@ -231,25 +231,25 @@ module Cucumber
231
231
  end
232
232
 
233
233
  define_feature(<<-FEATURE)
234
- Feature:
234
+ Feature:
235
235
  Scenario:
236
236
  Given snap
237
237
  FEATURE
238
238
 
239
239
  it { @doc.css('.embed img').first.attributes['src'].to_s.should == "snapshot.jpeg" }
240
240
  end
241
-
241
+
242
242
  describe "with an undefined Given step then an undefined And step" do
243
243
  define_feature(<<-FEATURE)
244
- Feature:
244
+ Feature:
245
245
  Scenario:
246
246
  Given some undefined step
247
247
  And another undefined step
248
248
  FEATURE
249
-
249
+
250
250
  it { @doc.css('pre').map { |pre| /^(Given|And)/.match(pre.text)[1] }.should == ["Given", "Given"] }
251
251
  end
252
-
252
+
253
253
  end
254
254
  end
255
255
  end