cucumber 0.8.6 → 0.8.7
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/.rspec +1 -1
- data/Caliper.yml +4 -0
- data/History.txt +1557 -0
- data/LICENSE +1 -1
- data/README.rdoc +26 -0
- data/Rakefile +51 -5
- data/VERSION.yml +5 -0
- data/bin/cucumber +1 -7
- data/cucumber.gemspec +77 -3
- data/examples/i18n/ar/features/step_definitons/calculator_steps.rb +1 -1
- data/examples/i18n/he/features/step_definitons/calculator_steps.rb +1 -1
- data/examples/i18n/ro/features/step_definitons/calculator_steps.rb +7 -4
- data/examples/i18n/ro/features/suma.feature +11 -0
- data/examples/i18n/ru/features/division.feature +2 -2
- data/examples/i18n/tr/features/step_definitons/hesap_makinesi_adimlari.rb +3 -3
- data/examples/sinatra/features/support/env.rb +5 -2
- data/examples/v8/features/fibonacci.feature +1 -1
- data/examples/watir/features/step_definitions/search_steps.rb +1 -1
- data/features/announce.feature +164 -0
- data/features/around_hooks.feature +232 -0
- data/features/background.feature +95 -284
- data/features/bug_371.feature +32 -0
- data/features/bug_464.feature +16 -0
- data/features/bug_475.feature +42 -0
- data/features/bug_585_tab_indentation.feature +22 -0
- data/features/bug_600.feature +67 -0
- data/features/call_steps_from_stepdefs.feature +154 -0
- data/features/cucumber_cli.feature +591 -0
- data/features/cucumber_cli_outlines.feature +117 -0
- data/features/custom_formatter.feature +73 -3
- data/features/default_snippets.feature +42 -0
- data/features/diffing.feature +25 -0
- data/features/drb_server_integration.feature +174 -0
- data/features/exception_in_after_block.feature +127 -0
- data/features/exception_in_after_step_block.feature +104 -0
- data/features/exception_in_before_block.feature +98 -0
- data/features/exclude_files.feature +20 -0
- data/features/expand.feature +60 -0
- data/features/html_formatter.feature +8 -0
- data/features/html_formatter/a.html +582 -0
- data/features/json_formatter.feature +245 -160
- data/features/junit_formatter.feature +88 -0
- data/features/language_from_header.feature +30 -0
- data/features/language_help.feature +78 -0
- data/features/listener_debugger_formatter.feature +42 -0
- data/features/multiline_names.feature +44 -0
- data/features/negative_tagged_hooks.feature +60 -0
- data/features/post_configuration_hook.feature +37 -0
- data/features/profiles.feature +126 -0
- data/features/rake_task.feature +152 -0
- data/features/report_called_undefined_steps.feature +34 -0
- data/features/rerun_formatter.feature +45 -0
- data/features/simplest.feature +11 -0
- data/features/snippet.feature +23 -0
- data/features/snippets_when_using_star_keyword.feature +36 -0
- data/features/step_definitions/cucumber_steps.rb +153 -7
- data/features/step_definitions/extra_steps.rb +2 -0
- data/features/step_definitions/simplest_steps.rb +3 -0
- data/features/step_definitions/wire_steps.rb +32 -0
- data/features/support/env.rb +140 -18
- data/features/support/env.rb.simplest +7 -0
- data/features/support/fake_wire_server.rb +77 -0
- data/features/table_diffing.feature +45 -0
- data/features/table_mapping.feature +34 -0
- data/features/tag_logic.feature +258 -0
- data/features/transform.feature +245 -0
- data/features/unicode_table.feature +35 -0
- data/features/usage_and_stepdefs_formatter.feature +169 -0
- data/features/wire_protocol.feature +332 -0
- data/features/wire_protocol_table_diffing.feature +119 -0
- data/features/wire_protocol_tags.feature +87 -0
- data/features/wire_protocol_timeouts.feature +63 -0
- data/features/work_in_progress.feature +156 -0
- data/fixtures/json/features/pystring.feature +8 -0
- data/fixtures/junit/features/pending.feature +1 -3
- data/fixtures/self_test/features/background/background_tagged_before_on_outline.feature +12 -0
- data/fixtures/self_test/features/background/background_with_name.feature +7 -0
- data/fixtures/self_test/features/background/failing_background.feature +12 -0
- data/fixtures/self_test/features/background/failing_background_after_success.feature +11 -0
- data/fixtures/self_test/features/background/multiline_args_background.feature +32 -0
- data/fixtures/self_test/features/background/passing_background.feature +10 -0
- data/fixtures/self_test/features/background/pending_background.feature +10 -0
- data/fixtures/self_test/features/background/scenario_outline_failing_background.feature +16 -0
- data/fixtures/self_test/features/background/scenario_outline_passing_background.feature +16 -0
- data/fixtures/self_test/features/support/env.rb +0 -8
- data/fixtures/tickets/features.html +1 -1
- data/gem_tasks/examples.rake +1 -1
- data/gem_tasks/features.rake +14 -0
- data/gem_tasks/sdoc.rake +12 -0
- data/lib/cucumber.rb +0 -12
- data/lib/cucumber/ast.rb +1 -1
- data/lib/cucumber/ast/background.rb +5 -21
- data/lib/cucumber/ast/examples.rb +4 -12
- data/lib/cucumber/ast/feature.rb +5 -13
- data/lib/cucumber/ast/feature_element.rb +4 -9
- data/lib/cucumber/ast/outline_table.rb +4 -4
- data/lib/cucumber/ast/py_string.rb +80 -0
- data/lib/cucumber/ast/scenario.rb +5 -7
- data/lib/cucumber/ast/scenario_outline.rb +15 -23
- data/lib/cucumber/ast/step.rb +0 -5
- data/lib/cucumber/ast/step_invocation.rb +15 -21
- data/lib/cucumber/ast/table.rb +8 -14
- data/lib/cucumber/ast/tree_walker.rb +48 -10
- data/lib/cucumber/cli/configuration.rb +8 -33
- data/lib/cucumber/cli/main.rb +35 -20
- data/lib/cucumber/cli/options.rb +7 -8
- data/lib/cucumber/cli/profile_loader.rb +0 -2
- data/lib/cucumber/core_ext/proc.rb +1 -2
- data/lib/cucumber/feature_file.rb +15 -47
- data/lib/cucumber/formatter/ansicolor.rb +5 -3
- data/lib/cucumber/formatter/color_io.rb +23 -0
- data/lib/cucumber/formatter/console.rb +23 -27
- data/lib/cucumber/formatter/cucumber.css +17 -34
- data/lib/cucumber/formatter/cucumber.sass +182 -173
- data/lib/cucumber/formatter/html.rb +11 -46
- data/lib/cucumber/formatter/io.rb +4 -2
- data/lib/cucumber/formatter/json.rb +152 -15
- data/lib/cucumber/formatter/json_pretty.rb +6 -5
- data/lib/cucumber/formatter/junit.rb +22 -28
- data/lib/cucumber/formatter/pdf.rb +6 -6
- data/lib/cucumber/formatter/pretty.rb +5 -5
- data/lib/cucumber/formatter/rerun.rb +11 -22
- data/lib/cucumber/formatter/tag_cloud.rb +35 -0
- data/lib/cucumber/formatter/unicode.rb +20 -41
- data/lib/cucumber/js_support/js_dsl.js +4 -4
- data/lib/cucumber/js_support/js_language.rb +5 -9
- data/lib/cucumber/js_support/js_snippets.rb +2 -2
- data/lib/cucumber/language_support.rb +2 -2
- data/lib/cucumber/parser/gherkin_builder.rb +30 -35
- data/lib/cucumber/platform.rb +8 -8
- data/lib/cucumber/py_support/py_language.rb +2 -2
- data/lib/cucumber/rake/task.rb +31 -74
- data/lib/cucumber/rb_support/rb_dsl.rb +0 -1
- data/lib/cucumber/rb_support/rb_language.rb +8 -10
- data/lib/cucumber/rb_support/rb_step_definition.rb +0 -8
- data/lib/cucumber/rb_support/rb_transform.rb +0 -17
- data/lib/cucumber/rb_support/rb_world.rb +18 -26
- data/lib/cucumber/rspec/doubles.rb +3 -3
- data/lib/cucumber/step_match.rb +2 -6
- data/lib/cucumber/step_mother.rb +427 -6
- data/lib/cucumber/wire_support/configuration.rb +1 -4
- data/lib/cucumber/wire_support/wire_language.rb +10 -3
- data/spec/cucumber/ast/background_spec.rb +6 -68
- data/spec/cucumber/ast/feature_factory.rb +4 -5
- data/spec/cucumber/ast/feature_spec.rb +4 -4
- data/spec/cucumber/ast/outline_table_spec.rb +1 -1
- data/spec/cucumber/ast/py_string_spec.rb +40 -0
- data/spec/cucumber/ast/scenario_outline_spec.rb +11 -15
- data/spec/cucumber/ast/scenario_spec.rb +4 -4
- data/spec/cucumber/ast/step_spec.rb +3 -3
- data/spec/cucumber/ast/table_spec.rb +2 -38
- data/spec/cucumber/ast/tree_walker_spec.rb +2 -2
- data/spec/cucumber/broadcaster_spec.rb +1 -1
- data/spec/cucumber/cli/configuration_spec.rb +6 -32
- data/spec/cucumber/cli/drb_client_spec.rb +3 -2
- data/spec/cucumber/cli/main_spec.rb +43 -43
- data/spec/cucumber/cli/options_spec.rb +1 -28
- data/spec/cucumber/cli/profile_loader_spec.rb +1 -1
- data/spec/cucumber/core_ext/proc_spec.rb +1 -1
- data/spec/cucumber/formatter/ansicolor_spec.rb +1 -1
- data/spec/cucumber/formatter/color_io_spec.rb +29 -0
- data/spec/cucumber/formatter/duration_spec.rb +1 -1
- data/spec/cucumber/formatter/html_spec.rb +5 -3
- data/spec/cucumber/formatter/junit_spec.rb +2 -16
- data/spec/cucumber/formatter/progress_spec.rb +1 -1
- data/spec/cucumber/formatter/spec_helper.rb +12 -11
- data/spec/cucumber/rb_support/rb_language_spec.rb +28 -241
- data/spec/cucumber/rb_support/rb_step_definition_spec.rb +28 -33
- data/spec/cucumber/rb_support/regexp_argument_matcher_spec.rb +1 -1
- data/spec/cucumber/step_match_spec.rb +9 -11
- data/spec/cucumber/step_mother_spec.rb +302 -0
- data/spec/cucumber/wire_support/configuration_spec.rb +1 -1
- data/spec/cucumber/wire_support/connection_spec.rb +1 -1
- data/spec/cucumber/wire_support/wire_exception_spec.rb +1 -1
- data/spec/cucumber/wire_support/wire_language_spec.rb +1 -1
- data/spec/cucumber/wire_support/wire_packet_spec.rb +1 -1
- data/spec/cucumber/wire_support/wire_step_definition_spec.rb +1 -1
- data/spec/cucumber/world/pending_spec.rb +2 -2
- data/spec/spec_helper.rb +20 -13
- metadata +78 -4
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
require 'spec_helper'
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
|
|
2
2
|
require 'yaml'
|
|
3
3
|
|
|
4
4
|
module Cucumber
|
|
5
5
|
module Cli
|
|
6
6
|
describe Configuration do
|
|
7
|
-
module ExposesOptions
|
|
8
|
-
attr_reader :options
|
|
9
|
-
end
|
|
10
7
|
|
|
11
8
|
def given_cucumber_yml_defined_as(hash_or_string)
|
|
12
9
|
File.stub!(:exist?).and_return(true)
|
|
@@ -26,7 +23,7 @@ module Cli
|
|
|
26
23
|
end
|
|
27
24
|
|
|
28
25
|
def config
|
|
29
|
-
@config ||= Configuration.new(@out = StringIO.new, @error = StringIO.new)
|
|
26
|
+
@config ||= Configuration.new(@out = StringIO.new, @error = StringIO.new)
|
|
30
27
|
end
|
|
31
28
|
|
|
32
29
|
def reset_config
|
|
@@ -290,17 +287,17 @@ END_OF_MESSAGE
|
|
|
290
287
|
|
|
291
288
|
it "should accept --out option" do
|
|
292
289
|
config.parse!(%w{--out jalla.txt})
|
|
293
|
-
config.formats.should == [['pretty', 'jalla.txt']]
|
|
290
|
+
config.options[:formats].should == [['pretty', 'jalla.txt']]
|
|
294
291
|
end
|
|
295
292
|
|
|
296
293
|
it "should accept multiple --out options" do
|
|
297
294
|
config.parse!(%w{--format progress --out file1 --out file2})
|
|
298
|
-
config.formats.should == [['progress', 'file2']]
|
|
295
|
+
config.options[:formats].should == [['progress', 'file2']]
|
|
299
296
|
end
|
|
300
297
|
|
|
301
298
|
it "should accept multiple --format options and put the STDOUT one first so progress is seen" do
|
|
302
299
|
config.parse!(%w{--format pretty --out pretty.txt --format progress})
|
|
303
|
-
config.formats.should == [['progress', out], ['pretty', 'pretty.txt']]
|
|
300
|
+
config.options[:formats].should == [['progress', out], ['pretty', 'pretty.txt']]
|
|
304
301
|
end
|
|
305
302
|
|
|
306
303
|
it "should not accept multiple --format options when both use implicit STDOUT" do
|
|
@@ -317,7 +314,7 @@ END_OF_MESSAGE
|
|
|
317
314
|
|
|
318
315
|
it "should associate --out to previous --format" do
|
|
319
316
|
config.parse!(%w{--format progress --out file1 --format profile --out file2})
|
|
320
|
-
config.formats.should == [["progress", "file1"], ["profile" ,"file2"]]
|
|
317
|
+
config.options[:formats].should == [["progress", "file1"], ["profile" ,"file2"]]
|
|
321
318
|
end
|
|
322
319
|
|
|
323
320
|
it "should accept --color option" do
|
|
@@ -402,30 +399,7 @@ END_OF_MESSAGE
|
|
|
402
399
|
ENV["RAILS_ENV"].should == "selenium"
|
|
403
400
|
config.feature_files.should_not include('RAILS_ENV=selenium')
|
|
404
401
|
end
|
|
405
|
-
|
|
406
|
-
describe "#tag_expression" do
|
|
407
|
-
it "returns an empty expression when no tags are specified" do
|
|
408
|
-
config.parse!([])
|
|
409
|
-
config.tag_expression.should be_empty
|
|
410
|
-
end
|
|
411
402
|
|
|
412
|
-
it "returns an expression when tags are specified" do
|
|
413
|
-
config.parse!(['--tags','@foo'])
|
|
414
|
-
config.tag_expression.should_not be_empty
|
|
415
|
-
end
|
|
416
|
-
end
|
|
417
|
-
|
|
418
|
-
describe "#dry_run?" do
|
|
419
|
-
it "returns true when --dry-run was specified on in the arguments" do
|
|
420
|
-
config.parse!(['--dry-run'])
|
|
421
|
-
config.dry_run?.should be_true
|
|
422
|
-
end
|
|
423
|
-
|
|
424
|
-
it "returns false by default" do
|
|
425
|
-
config.parse!([])
|
|
426
|
-
config.dry_run?.should be_false
|
|
427
|
-
end
|
|
428
|
-
end
|
|
429
403
|
end
|
|
430
404
|
end
|
|
431
405
|
end
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
require 'spec_helper'
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
|
|
2
|
+
|
|
2
3
|
|
|
3
4
|
module Cucumber
|
|
4
5
|
module Cli
|
|
@@ -29,7 +30,7 @@ module Cucumber
|
|
|
29
30
|
|
|
30
31
|
it "returns raises an error when it can't connect to the server" do
|
|
31
32
|
DRbObject.stub!(:new_with_uri).and_raise(DRb::DRbConnError)
|
|
32
|
-
|
|
33
|
+
running { DRbClient.run(@args, @error_stream, @out_stream) }.should raise_error(DRbClientError, "No DRb server is running.")
|
|
33
34
|
end
|
|
34
35
|
|
|
35
36
|
it "returns the result from the DRb server call" do
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
require 'spec_helper'
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
|
|
2
2
|
require 'yaml'
|
|
3
|
-
require 'cucumber/parser/gherkin_builder'
|
|
4
|
-
require 'gherkin/formatter/model'
|
|
5
3
|
|
|
6
4
|
module Cucumber
|
|
7
5
|
module Cli
|
|
@@ -13,41 +11,11 @@ module Cucumber
|
|
|
13
11
|
File.stub!(:exist?).and_return(false) # When Configuration checks for cucumber.yml
|
|
14
12
|
Dir.stub!(:[]).and_return([]) # to prevent cucumber's features dir to being laoded
|
|
15
13
|
end
|
|
16
|
-
|
|
17
|
-
let(:args) { [] }
|
|
18
|
-
let(:out_stream) { nil }
|
|
19
|
-
let(:err_stream) { nil }
|
|
20
|
-
subject { Main.new(args, out_stream, err_stream)}
|
|
21
|
-
|
|
22
|
-
describe "#execute!" do
|
|
23
|
-
context "passed an existing runtime" do
|
|
24
|
-
let(:existing_runtime) { double('runtime').as_null_object }
|
|
25
|
-
|
|
26
|
-
def do_execute
|
|
27
|
-
subject.execute!(existing_runtime)
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
it "configures that runtime" do
|
|
31
|
-
expected_configuration = double('Configuration', :drb? => false).as_null_object
|
|
32
|
-
Configuration.stub!(:new => expected_configuration)
|
|
33
|
-
existing_runtime.should_receive(:configure).with(expected_configuration)
|
|
34
|
-
do_execute
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
it "uses that runtime for running and reporting results" do
|
|
38
|
-
expected_results = double('results', :failure? => true)
|
|
39
|
-
existing_runtime.should_receive(:run!)
|
|
40
|
-
existing_runtime.stub!(:results).and_return(expected_results)
|
|
41
|
-
do_execute.should == expected_results.failure?
|
|
42
|
-
end
|
|
43
|
-
end
|
|
44
|
-
end
|
|
45
14
|
|
|
46
15
|
describe "verbose mode" do
|
|
47
16
|
|
|
48
17
|
before(:each) do
|
|
49
|
-
|
|
50
|
-
@empty_feature = b.feature(Gherkin::Formatter::Model::Feature.new([], [], "Feature", "Foo", "", 99))
|
|
18
|
+
@empty_feature = Cucumber::Ast::Feature.new(nil, Cucumber::Ast::Comment.new(''), Cucumber::Ast::Tags.new(2, []), "Feature", "Foo", [])
|
|
51
19
|
end
|
|
52
20
|
|
|
53
21
|
it "should show feature files parsed" do
|
|
@@ -56,7 +24,7 @@ module Cucumber
|
|
|
56
24
|
|
|
57
25
|
Cucumber::FeatureFile.stub!(:new).and_return(mock("feature file", :parse => @empty_feature))
|
|
58
26
|
|
|
59
|
-
@cli.execute!
|
|
27
|
+
@cli.execute!(Cucumber::StepMother.new)
|
|
60
28
|
|
|
61
29
|
@out.string.should include('example.feature')
|
|
62
30
|
end
|
|
@@ -64,7 +32,9 @@ module Cucumber
|
|
|
64
32
|
end
|
|
65
33
|
|
|
66
34
|
describe "--format with class" do
|
|
67
|
-
|
|
35
|
+
|
|
36
|
+
describe "in module" do
|
|
37
|
+
|
|
68
38
|
it "should resolve each module until it gets Formatter class" do
|
|
69
39
|
cli = Main.new(%w{--format ZooModule::MonkeyFormatterClass}, nil)
|
|
70
40
|
mock_module = mock('module')
|
|
@@ -76,11 +46,42 @@ module Cucumber
|
|
|
76
46
|
Object.should_receive(:const_get).with('ZooModule').and_return(mock_module)
|
|
77
47
|
mock_module.should_receive(:const_get).with('MonkeyFormatterClass').and_return(mock('formatter class', :new => f))
|
|
78
48
|
|
|
79
|
-
cli.execute!
|
|
49
|
+
cli.execute!(Cucumber::StepMother.new)
|
|
80
50
|
end
|
|
51
|
+
|
|
81
52
|
end
|
|
82
53
|
end
|
|
83
54
|
|
|
55
|
+
describe "setup step sequence" do
|
|
56
|
+
|
|
57
|
+
it "should load files and execute hooks in order" do
|
|
58
|
+
Configuration.stub!(:new).and_return(configuration = mock('configuration').as_null_object)
|
|
59
|
+
step_mother = mock('step mother').as_null_object
|
|
60
|
+
configuration.stub!(:drb?).and_return false
|
|
61
|
+
cli = Main.new(%w{--verbose example.feature}, @out)
|
|
62
|
+
cli.stub!(:require)
|
|
63
|
+
|
|
64
|
+
configuration.stub!(:support_to_load).and_return(['support'])
|
|
65
|
+
configuration.stub!(:step_defs_to_load).and_return(['step defs'])
|
|
66
|
+
|
|
67
|
+
# Support must be loaded first to ensure post configuration hook can
|
|
68
|
+
# run before anything else.
|
|
69
|
+
step_mother.should_receive(:load_code_files).with(['support']).ordered
|
|
70
|
+
# The post configuration hook/s (if any) need to be run next to enable
|
|
71
|
+
# extensions to do their thing before features are loaded
|
|
72
|
+
step_mother.should_receive(:after_configuration).with(configuration).ordered
|
|
73
|
+
# Feature files must be loaded before step definitions are required.
|
|
74
|
+
# This is because i18n step methods are only aliased when
|
|
75
|
+
# features are loaded. If we swap the order, the requires
|
|
76
|
+
# will fail.
|
|
77
|
+
step_mother.should_receive(:load_plain_text_features).ordered
|
|
78
|
+
step_mother.should_receive(:load_code_files).with(['step defs']).ordered
|
|
79
|
+
|
|
80
|
+
cli.execute!(step_mother)
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
end
|
|
84
|
+
|
|
84
85
|
[ProfilesNotDefinedError, YmlLoadError, ProfileNotFound].each do |exception_klass|
|
|
85
86
|
|
|
86
87
|
it "rescues #{exception_klass}, prints the message to the error stream and returns true" do
|
|
@@ -88,7 +89,7 @@ module Cucumber
|
|
|
88
89
|
configuration.stub!(:parse!).and_raise(exception_klass.new("error message"))
|
|
89
90
|
|
|
90
91
|
main = Main.new('', out = StringIO.new, error = StringIO.new)
|
|
91
|
-
main.execute
|
|
92
|
+
main.execute!(Cucumber::StepMother.new).should be_true
|
|
92
93
|
error.string.should == "error message\n"
|
|
93
94
|
end
|
|
94
95
|
end
|
|
@@ -102,31 +103,30 @@ module Cucumber
|
|
|
102
103
|
|
|
103
104
|
@cli = Main.new(@args, @out, @err)
|
|
104
105
|
@step_mother = mock('StepMother').as_null_object
|
|
105
|
-
StepMother.stub!(:new).and_return(@step_mother)
|
|
106
106
|
end
|
|
107
107
|
|
|
108
108
|
it "delegates the execution to the DRB client passing the args and streams" do
|
|
109
109
|
@configuration.stub :drb_port => 1450
|
|
110
110
|
DRbClient.should_receive(:run).with(@args, @err, @out, 1450).and_return(true)
|
|
111
|
-
@cli.execute!
|
|
111
|
+
@cli.execute!(@step_mother)
|
|
112
112
|
end
|
|
113
113
|
|
|
114
114
|
it "returns the result from the DRbClient" do
|
|
115
115
|
DRbClient.stub!(:run).and_return('foo')
|
|
116
|
-
@cli.execute
|
|
116
|
+
@cli.execute!(@step_mother).should == 'foo'
|
|
117
117
|
end
|
|
118
118
|
|
|
119
119
|
it "ceases execution if the DrbClient is able to perform the execution" do
|
|
120
120
|
DRbClient.stub!(:run).and_return(true)
|
|
121
121
|
@configuration.should_not_receive(:build_formatter_broadcaster)
|
|
122
|
-
@cli.execute!
|
|
122
|
+
@cli.execute!(@step_mother)
|
|
123
123
|
end
|
|
124
124
|
|
|
125
125
|
context "when the DrbClient is unable to perfrom the execution" do
|
|
126
126
|
before { DRbClient.stub!(:run).and_raise(DRbClientError.new('error message.')) }
|
|
127
127
|
|
|
128
128
|
it "alerts the user that execution will be performed locally" do
|
|
129
|
-
@cli.execute!
|
|
129
|
+
@cli.execute!(@step_mother)
|
|
130
130
|
@err.string.should include("WARNING: error message. Running features locally:")
|
|
131
131
|
end
|
|
132
132
|
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
require 'spec_helper'
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
|
|
2
2
|
require 'yaml'
|
|
3
|
-
require 'cucumber/cli/options'
|
|
4
3
|
|
|
5
4
|
module Cucumber
|
|
6
5
|
module Cli
|
|
@@ -112,13 +111,6 @@ module Cli
|
|
|
112
111
|
end
|
|
113
112
|
end
|
|
114
113
|
|
|
115
|
-
context '-l LINES or --lines LINES' do
|
|
116
|
-
it "adds line numbers to args" do
|
|
117
|
-
options.parse!(%w{-l24 FILE})
|
|
118
|
-
options.instance_variable_get(:@args).should == ['FILE:24']
|
|
119
|
-
end
|
|
120
|
-
end
|
|
121
|
-
|
|
122
114
|
context '-p PROFILE or --profile PROFILE' do
|
|
123
115
|
|
|
124
116
|
it "notifies the user that an individual profile is being used" do
|
|
@@ -332,25 +324,6 @@ module Cli
|
|
|
332
324
|
|
|
333
325
|
end
|
|
334
326
|
|
|
335
|
-
describe "dry-run" do
|
|
336
|
-
it "should have the default value for snippets" do
|
|
337
|
-
given_cucumber_yml_defined_as({'foo' => %w[--dry-run]})
|
|
338
|
-
options.parse!(%w{--dry-run})
|
|
339
|
-
options[:snippets].should == true
|
|
340
|
-
end
|
|
341
|
-
|
|
342
|
-
it "should set snippets to false when no-snippets provided after dry-run" do
|
|
343
|
-
given_cucumber_yml_defined_as({'foo' => %w[--dry-run --no-snippets]})
|
|
344
|
-
options.parse!(%w{--dry-run --no-snippets})
|
|
345
|
-
options[:snippets].should == false
|
|
346
|
-
end
|
|
347
|
-
|
|
348
|
-
it "should set snippets to false when no-snippets provided before dry-run" do
|
|
349
|
-
given_cucumber_yml_defined_as({'foo' => %w[--no-snippet --dry-run]})
|
|
350
|
-
options.parse!(%w{--no-snippets --dry-run})
|
|
351
|
-
options[:snippets].should == false
|
|
352
|
-
end
|
|
353
|
-
end
|
|
354
327
|
end
|
|
355
328
|
|
|
356
329
|
end
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
|
|
2
|
+
require 'cucumber/formatter/color_io'
|
|
3
|
+
|
|
4
|
+
module Cucumber
|
|
5
|
+
module Formatter
|
|
6
|
+
describe ColorIO do
|
|
7
|
+
describe "<<" do
|
|
8
|
+
it "should convert to a print using kernel" do
|
|
9
|
+
kernel = mock('Kernel')
|
|
10
|
+
color_io = ColorIO.new(kernel, nil)
|
|
11
|
+
|
|
12
|
+
kernel.should_receive(:print).with("monkeys")
|
|
13
|
+
|
|
14
|
+
color_io << "monkeys"
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
it "should allow chained <<" do
|
|
18
|
+
kernel = mock('Kernel')
|
|
19
|
+
color_io = ColorIO.new(kernel, nil)
|
|
20
|
+
|
|
21
|
+
kernel.should_receive(:print).with("monkeys")
|
|
22
|
+
kernel.should_receive(:print).with(" are tasty")
|
|
23
|
+
|
|
24
|
+
color_io << "monkeys" << " are tasty"
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
require 'spec_helper'
|
|
2
|
-
require '
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
|
|
2
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
|
3
3
|
require 'cucumber/formatter/html'
|
|
4
4
|
require 'nokogiri'
|
|
5
5
|
require 'cucumber/rb_support/rb_language'
|
|
@@ -11,7 +11,9 @@ module Cucumber
|
|
|
11
11
|
extend SpecHelperDsl
|
|
12
12
|
include SpecHelper
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
matcher = defined?(Spec::Matchers) ? Spec::Matchers : RSpec::Matchers
|
|
15
|
+
|
|
16
|
+
matcher.define :have_css_node do |css, regexp|
|
|
15
17
|
match do |doc|
|
|
16
18
|
nodes = doc.css(css)
|
|
17
19
|
nodes.detect{ |node| node.text =~ regexp }
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
require 'spec_helper'
|
|
2
|
-
require '
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
|
|
2
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
|
3
3
|
|
|
4
4
|
require 'cucumber/formatter/junit'
|
|
5
5
|
require 'nokogiri'
|
|
@@ -51,19 +51,6 @@ module Cucumber::Formatter
|
|
|
51
51
|
|
|
52
52
|
it { @doc.to_s.should =~ /One passing scenario, one failing scenario/ }
|
|
53
53
|
end
|
|
54
|
-
|
|
55
|
-
describe "with a scenario in a subdirectory" do
|
|
56
|
-
define_feature %{
|
|
57
|
-
Feature: One passing scenario, one failing scenario
|
|
58
|
-
|
|
59
|
-
Scenario: Passing
|
|
60
|
-
Given a passing scenario
|
|
61
|
-
}, File.join('features', 'some', 'path', 'spec.feature')
|
|
62
|
-
|
|
63
|
-
it 'writes the filename including the subdirectory' do
|
|
64
|
-
@formatter.written_files.keys.first.should == File.join('', 'TEST-some_path_spec.xml')
|
|
65
|
-
end
|
|
66
|
-
end
|
|
67
54
|
|
|
68
55
|
describe "with a scenario outline table" do
|
|
69
56
|
define_steps do
|
|
@@ -94,7 +81,6 @@ module Cucumber::Formatter
|
|
|
94
81
|
it { @doc.to_s.should =~ /Big Mac/ }
|
|
95
82
|
it { @doc.to_s.should_not =~ /Things/ }
|
|
96
83
|
it { @doc.to_s.should_not =~ /Good|Evil/ }
|
|
97
|
-
it { @doc.to_s.should_not =~ /type="skipped"/}
|
|
98
84
|
end
|
|
99
85
|
|
|
100
86
|
describe "with a regular data table scenario" do
|
|
@@ -2,11 +2,10 @@ module Cucumber
|
|
|
2
2
|
module Formatter
|
|
3
3
|
|
|
4
4
|
module SpecHelperDsl
|
|
5
|
-
attr_reader :feature_content, :step_defs
|
|
5
|
+
attr_reader :feature_content, :step_defs
|
|
6
6
|
|
|
7
|
-
def define_feature(string
|
|
7
|
+
def define_feature(string)
|
|
8
8
|
@feature_content = string
|
|
9
|
-
@feature_filename = feature_file
|
|
10
9
|
end
|
|
11
10
|
|
|
12
11
|
def define_steps(&block)
|
|
@@ -22,31 +21,33 @@ module Cucumber
|
|
|
22
21
|
end
|
|
23
22
|
|
|
24
23
|
def step_mother
|
|
25
|
-
@step_mother ||=
|
|
24
|
+
@step_mother ||= StepMother.new
|
|
26
25
|
end
|
|
27
26
|
|
|
28
27
|
def load_features(content)
|
|
29
|
-
feature_file = FeatureFile.new(
|
|
28
|
+
feature_file = FeatureFile.new('spec.feature', content)
|
|
30
29
|
features = Ast::Features.new
|
|
31
|
-
|
|
32
|
-
feature = feature_file.parse(filters, {})
|
|
30
|
+
feature = feature_file.parse(options, {})
|
|
33
31
|
features.add_feature(feature) if feature
|
|
34
32
|
features
|
|
35
33
|
end
|
|
36
34
|
|
|
37
35
|
def run(features)
|
|
38
|
-
|
|
39
|
-
tree_walker = Cucumber::Ast::TreeWalker.new(step_mother, [@formatter], configuration)
|
|
36
|
+
tree_walker = Cucumber::Ast::TreeWalker.new(@step_mother, [@formatter], options, STDOUT)
|
|
40
37
|
tree_walker.visit_features(features)
|
|
41
38
|
end
|
|
42
39
|
|
|
43
40
|
def define_steps
|
|
44
41
|
return unless step_defs = self.class.step_defs
|
|
45
|
-
rb = step_mother.load_programming_language('rb')
|
|
46
|
-
dsl = Object.new
|
|
42
|
+
rb = @step_mother.load_programming_language('rb')
|
|
43
|
+
dsl = Object.new
|
|
47
44
|
dsl.extend RbSupport::RbDsl
|
|
48
45
|
dsl.instance_exec &step_defs
|
|
49
46
|
end
|
|
47
|
+
|
|
48
|
+
def options
|
|
49
|
+
@options ||= mock(Cucumber::Cli::Options, :filters => [], :[] => nil)
|
|
50
|
+
end
|
|
50
51
|
end
|
|
51
52
|
end
|
|
52
53
|
end
|