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.
- data/.rvmrc +1 -1
- data/.travis.yml +3 -2
- data/DEVELOPERS.md +48 -0
- data/History.md +22 -3
- data/README.md +13 -31
- data/Rakefile +1 -0
- data/cucumber.gemspec +18 -17
- data/cucumber.yml +3 -2
- data/examples/i18n/cs/Rakefile +6 -0
- data/examples/i18n/cs/features/addition.feature +17 -0
- data/examples/i18n/cs/features/division.feature +11 -0
- data/examples/i18n/cs/features/step_definitons/calculator_steps.rb +24 -0
- data/examples/i18n/cs/lib/calculator.rb +14 -0
- data/examples/i18n/hi/Rakefile +6 -0
- data/examples/i18n/hi/features/addition.feature +16 -0
- data/examples/i18n/hi/features/division.feature +10 -0
- data/examples/i18n/hi/features/step_definitons/calculator_steps.rb +24 -0
- data/examples/i18n/hi/lib/calculator.rb +15 -0
- data/examples/python/README.textile +2 -1
- data/examples/ruby2python/README.textile +2 -1
- data/features/.cucumber/stepdefs.json +1688 -445
- data/features/assertions.feature +69 -0
- data/features/formatter_callbacks.feature +189 -0
- data/features/html_formatter.feature +19 -0
- data/features/json_formatter.feature +8 -4
- data/features/nested_steps_with_second_arg.feature +73 -0
- data/features/step_definitions.feature +65 -0
- data/features/step_definitions/cucumber_steps.rb +18 -3
- data/fixtures/self_test/features/support/env.rb +1 -1
- data/gem_tasks/cucumber.rake +5 -3
- data/gem_tasks/downloads.rb +3 -3
- data/gem_tasks/stats +4 -2
- data/gem_tasks/yard.rake +31 -13
- data/legacy_features/default_snippets.feature +3 -3
- data/legacy_features/language_help.feature +4 -0
- data/legacy_features/report_called_undefined_steps.feature +1 -1
- data/legacy_features/snippet.feature +3 -3
- data/legacy_features/snippets_when_using_star_keyword.feature +1 -1
- data/legacy_features/step_definitions/cucumber_steps.rb +4 -3
- data/legacy_features/support/env.rb +1 -1
- data/legacy_features/support/fake_wire_server.rb +9 -9
- data/lib/autotest/cucumber_mixin.rb +14 -14
- data/lib/autotest/discover.rb +2 -0
- data/lib/cucumber.rb +2 -2
- data/lib/cucumber/ast.rb +1 -1
- data/lib/cucumber/ast/background.rb +11 -7
- data/lib/cucumber/ast/comment.rb +2 -2
- data/lib/cucumber/ast/doc_string.rb +1 -1
- data/lib/cucumber/ast/examples.rb +1 -1
- data/lib/cucumber/ast/feature.rb +2 -2
- data/lib/cucumber/ast/feature_element.rb +1 -1
- data/lib/cucumber/ast/multiline_argument.rb +2 -2
- data/lib/cucumber/ast/names.rb +2 -2
- data/lib/cucumber/ast/outline_table.rb +4 -5
- data/lib/cucumber/ast/scenario.rb +14 -14
- data/lib/cucumber/ast/scenario_outline.rb +4 -4
- data/lib/cucumber/ast/step.rb +3 -3
- data/lib/cucumber/ast/step_collection.rb +5 -5
- data/lib/cucumber/ast/step_invocation.rb +8 -8
- data/lib/cucumber/ast/table.rb +40 -27
- data/lib/cucumber/ast/tree_walker.rb +9 -8
- data/lib/cucumber/ast/visitor.rb +1 -1
- data/lib/cucumber/cli/configuration.rb +10 -10
- data/lib/cucumber/cli/drb_client.rb +1 -1
- data/lib/cucumber/cli/main.rb +3 -3
- data/lib/cucumber/cli/options.rb +3 -2
- data/lib/cucumber/cli/profile_loader.rb +1 -1
- data/lib/cucumber/configuration.rb +12 -12
- data/lib/cucumber/constantize.rb +11 -2
- data/lib/cucumber/core_ext/disable_mini_and_test_unit_autorun.rb +1 -1
- data/lib/cucumber/core_ext/instance_exec.rb +4 -4
- data/lib/cucumber/core_ext/proc.rb +3 -3
- data/lib/cucumber/errors.rb +1 -1
- data/lib/cucumber/feature_file.rb +1 -1
- data/lib/cucumber/formatter/ansicolor.rb +36 -23
- data/lib/cucumber/formatter/console.rb +45 -25
- data/lib/cucumber/formatter/debug.rb +7 -7
- data/lib/cucumber/formatter/duration.rb +1 -1
- data/lib/cucumber/formatter/gherkin_formatter_adapter.rb +7 -0
- data/lib/cucumber/formatter/gpretty.rb +1 -1
- data/lib/cucumber/formatter/html.rb +52 -53
- data/lib/cucumber/formatter/interceptor.rb +2 -2
- data/lib/cucumber/formatter/json.rb +1 -1
- data/lib/cucumber/formatter/json_pretty.rb +2 -1
- data/lib/cucumber/formatter/junit.rb +1 -1
- data/lib/cucumber/formatter/ordered_xml_markup.rb +1 -1
- data/lib/cucumber/formatter/pretty.rb +12 -12
- data/lib/cucumber/formatter/progress.rb +5 -5
- data/lib/cucumber/formatter/rerun.rb +5 -5
- data/lib/cucumber/formatter/stepdefs.rb +1 -1
- data/lib/cucumber/formatter/steps.rb +6 -6
- data/lib/cucumber/formatter/summary.rb +6 -6
- data/lib/cucumber/formatter/unicode.rb +18 -18
- data/lib/cucumber/formatter/usage.rb +7 -7
- data/lib/cucumber/js_support/js_dsl.js +1 -1
- data/lib/cucumber/language_support.rb +1 -1
- data/lib/cucumber/parser/gherkin_builder.rb +33 -33
- data/lib/cucumber/platform.rb +3 -2
- data/lib/cucumber/py_support/py_dsl.py +2 -2
- data/lib/cucumber/py_support/py_language.py +2 -2
- data/lib/cucumber/py_support/py_language.rb +2 -2
- data/lib/cucumber/rake/task.rb +4 -3
- data/lib/cucumber/rb_support/rb_dsl.rb +10 -10
- data/lib/cucumber/rb_support/rb_language.rb +27 -19
- data/lib/cucumber/rb_support/rb_step_definition.rb +39 -11
- data/lib/cucumber/rb_support/rb_transform.rb +3 -3
- data/lib/cucumber/rb_support/rb_world.rb +15 -15
- data/lib/cucumber/rb_support/regexp_argument_matcher.rb +1 -1
- data/lib/cucumber/rspec/disable_option_parser.rb +1 -1
- data/lib/cucumber/rspec/doubles.rb +1 -1
- data/lib/cucumber/runtime.rb +11 -10
- data/lib/cucumber/runtime/features_loader.rb +6 -6
- data/lib/cucumber/runtime/for_programming_languages.rb +8 -15
- data/lib/cucumber/runtime/results.rb +6 -6
- data/lib/cucumber/runtime/support_code.rb +37 -28
- data/lib/cucumber/runtime/user_interface.rb +4 -4
- data/lib/cucumber/step_definition_light.rb +4 -4
- data/lib/cucumber/step_definitions.rb +2 -3
- data/lib/cucumber/step_match.rb +6 -6
- data/lib/cucumber/step_mother.rb +1 -1
- data/lib/cucumber/term/ansicolor.rb +22 -22
- data/lib/cucumber/wire_support/configuration.rb +11 -14
- data/lib/cucumber/wire_support/connection.rb +10 -9
- data/lib/cucumber/wire_support/request_handler.rb +3 -3
- data/lib/cucumber/wire_support/wire_exception.rb +3 -3
- data/lib/cucumber/wire_support/wire_language.rb +11 -11
- data/lib/cucumber/wire_support/wire_packet.rb +7 -5
- data/lib/cucumber/wire_support/wire_protocol.rb +6 -6
- data/lib/cucumber/wire_support/wire_protocol/requests.rb +20 -20
- data/lib/cucumber/wire_support/wire_step_definition.rb +4 -4
- data/spec/cucumber/ast/background_spec.rb +4 -4
- data/spec/cucumber/ast/doc_string_spec.rb +8 -8
- data/spec/cucumber/ast/feature_factory.rb +4 -4
- data/spec/cucumber/ast/feature_spec.rb +18 -18
- data/spec/cucumber/ast/outline_table_spec.rb +3 -3
- data/spec/cucumber/ast/step_spec.rb +4 -4
- data/spec/cucumber/ast/table_spec.rb +50 -29
- data/spec/cucumber/ast/tree_walker_spec.rb +12 -4
- data/spec/cucumber/broadcaster_spec.rb +1 -1
- data/spec/cucumber/cli/configuration_spec.rb +10 -4
- data/spec/cucumber/cli/drb_client_spec.rb +1 -1
- data/spec/cucumber/cli/main_spec.rb +28 -7
- data/spec/cucumber/cli/options_spec.rb +3 -3
- data/spec/cucumber/configuration_spec.rb +4 -4
- data/spec/cucumber/constantize_spec.rb +2 -0
- data/spec/cucumber/core_ext/proc_spec.rb +7 -7
- data/spec/cucumber/formatter/ansicolor_spec.rb +2 -2
- data/spec/cucumber/formatter/duration_spec.rb +2 -2
- data/spec/cucumber/formatter/html_spec.rb +31 -31
- data/spec/cucumber/formatter/interceptor_spec.rb +10 -0
- data/spec/cucumber/formatter/progress_spec.rb +1 -1
- data/spec/cucumber/formatter/spec_helper.rb +7 -7
- data/spec/cucumber/rake/forked_spec.rb +15 -2
- data/spec/cucumber/rake/rcov_spec.rb +2 -2
- data/spec/cucumber/rb_support/rb_language_spec.rb +34 -17
- data/spec/cucumber/rb_support/rb_step_definition_spec.rb +45 -35
- data/spec/cucumber/rb_support/rb_transform_spec.rb +3 -3
- data/spec/cucumber/runtime/for_programming_languages_spec.rb +31 -0
- data/spec/cucumber/runtime/results_spec.rb +5 -5
- data/spec/cucumber/runtime/support_code_spec.rb +13 -2
- data/spec/cucumber/runtime_spec.rb +7 -7
- data/spec/cucumber/step_match_spec.rb +2 -2
- data/spec/cucumber/wire_support/configuration_spec.rb +16 -6
- data/spec/cucumber/wire_support/connection_spec.rb +25 -11
- data/spec/cucumber/wire_support/wire_exception_spec.rb +3 -3
- data/spec/cucumber/wire_support/wire_language_spec.rb +3 -3
- data/spec/cucumber/wire_support/wire_packet_spec.rb +4 -4
- data/spec/cucumber/wire_support/wire_step_definition_spec.rb +1 -1
- data/spec/spec_helper.rb +2 -2
- metadata +98 -128
- data/legacy_features/html_formatter.feature +0 -8
- data/legacy_features/html_formatter/a.html +0 -561
@@ -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
|
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
|
@@ -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
|
-
|
77
|
-
|
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
|
@@ -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::
|
39
|
-
|
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
|
-
}.
|
44
|
+
}.should raise_error(Cucumber::ArityMismatchError, "Your block takes 0 arguments, but the Regexp matched 1 argument.")
|
44
45
|
end
|
45
46
|
else
|
46
|
-
|
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
|
-
}.
|
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"
|
@@ -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
|