cucumber 0.8.6 → 0.8.7
Sign up to get free protection for your applications and to get access to all the features.
- 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,13 +1,10 @@
|
|
1
|
-
require 'yaml'
|
2
|
-
require 'erb'
|
3
|
-
|
4
1
|
module Cucumber
|
5
2
|
module WireSupport
|
6
3
|
class Configuration
|
7
4
|
attr_reader :host, :port
|
8
5
|
|
9
6
|
def initialize(wire_file)
|
10
|
-
params = YAML.
|
7
|
+
params = YAML.load_file(wire_file)
|
11
8
|
@host = params['host']
|
12
9
|
@port = params['port']
|
13
10
|
@timeouts = default_timeouts.merge(params['timeout'] || {})
|
@@ -1,5 +1,12 @@
|
|
1
1
|
require 'socket'
|
2
|
-
|
2
|
+
begin
|
3
|
+
require 'json'
|
4
|
+
rescue LoadError
|
5
|
+
STDERR.puts <<-EOM
|
6
|
+
You must gem install #{defined?(JRUBY_VERSION) ? 'json_pure' : 'json'} before you can use the wire support.
|
7
|
+
EOM
|
8
|
+
exit(1)
|
9
|
+
end
|
3
10
|
require 'cucumber/wire_support/connection'
|
4
11
|
require 'cucumber/wire_support/configuration'
|
5
12
|
require 'cucumber/wire_support/wire_packet'
|
@@ -26,9 +33,9 @@ module Cucumber
|
|
26
33
|
@connections << Connection.new(config)
|
27
34
|
end
|
28
35
|
|
29
|
-
def snippet_text(
|
36
|
+
def snippet_text(step_keyword, step_name, multiline_arg_class)
|
30
37
|
snippets = @connections.map do |remote|
|
31
|
-
remote.snippet_text(
|
38
|
+
remote.snippet_text(step_keyword, step_name, multiline_arg_class.to_s)
|
32
39
|
end
|
33
40
|
snippets.flatten.join("\n")
|
34
41
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require 'spec_helper'
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
|
2
2
|
require 'cucumber/ast'
|
3
3
|
require 'cucumber/rb_support/rb_language'
|
4
4
|
|
@@ -8,8 +8,8 @@ module Cucumber
|
|
8
8
|
|
9
9
|
before do
|
10
10
|
extend(Cucumber::RbSupport::RbDsl)
|
11
|
-
@
|
12
|
-
@rb = @
|
11
|
+
@step_mother = Cucumber::StepMother.new
|
12
|
+
@rb = @step_mother.load_programming_language('rb')
|
13
13
|
|
14
14
|
$x = $y = nil
|
15
15
|
Before do
|
@@ -19,7 +19,7 @@ module Cucumber
|
|
19
19
|
$y = $x * n.to_i
|
20
20
|
end
|
21
21
|
|
22
|
-
@visitor = TreeWalker.new(@
|
22
|
+
@visitor = TreeWalker.new(@step_mother)
|
23
23
|
|
24
24
|
@feature = mock('feature', :visit? => true).as_null_object
|
25
25
|
end
|
@@ -29,8 +29,7 @@ module Cucumber
|
|
29
29
|
comment=Comment.new(''),
|
30
30
|
line=2,
|
31
31
|
keyword="",
|
32
|
-
|
33
|
-
description="",
|
32
|
+
name="",
|
34
33
|
steps=[
|
35
34
|
Step.new(7, "Given", "y is 5")
|
36
35
|
])
|
@@ -41,8 +40,7 @@ module Cucumber
|
|
41
40
|
tags=Tags.new(98,[]),
|
42
41
|
line=99,
|
43
42
|
keyword="",
|
44
|
-
|
45
|
-
description="",
|
43
|
+
name="",
|
46
44
|
steps=[]
|
47
45
|
)
|
48
46
|
background.feature = @feature
|
@@ -50,66 +48,6 @@ module Cucumber
|
|
50
48
|
$x.should == 2
|
51
49
|
$y.should == 10
|
52
50
|
end
|
53
|
-
|
54
|
-
describe "should respond to #name" do
|
55
|
-
it "with a value" do
|
56
|
-
background = Background.new(
|
57
|
-
comment=Comment.new(''),
|
58
|
-
line=2,
|
59
|
-
keyword="",
|
60
|
-
title="background name",
|
61
|
-
description="",
|
62
|
-
steps=[])
|
63
|
-
lambda{ background.name }.should_not raise_error
|
64
|
-
background.name.should == 'background name'
|
65
|
-
end
|
66
|
-
it "without a value" do
|
67
|
-
background = Background.new(
|
68
|
-
comment=Comment.new(''),
|
69
|
-
line=2,
|
70
|
-
keyword="",
|
71
|
-
title="",
|
72
|
-
description="",
|
73
|
-
steps=[])
|
74
|
-
lambda{ background.name }.should_not raise_error
|
75
|
-
end
|
76
|
-
end
|
77
|
-
|
78
|
-
describe "failures in a Before hook" do
|
79
|
-
|
80
|
-
before do
|
81
|
-
Before do
|
82
|
-
raise Exception, "Exception from Before hook"
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
|
-
it "should state that the background has failed" do
|
87
|
-
# Assign
|
88
|
-
background = Background.new(
|
89
|
-
comment=Comment.new(''),
|
90
|
-
line=2,
|
91
|
-
keyword="",
|
92
|
-
title="",
|
93
|
-
description="",
|
94
|
-
steps=[
|
95
|
-
Step.new(7, "Given", "y is 5")
|
96
|
-
])
|
97
|
-
background.feature = @feature
|
98
|
-
|
99
|
-
# Expect
|
100
|
-
@visitor.should_receive( :visit_exception ) do |exception, status|
|
101
|
-
exception.should be_instance_of( Exception )
|
102
|
-
exception.message.should == "Exception from Before hook"
|
103
|
-
status.should == :failed
|
104
|
-
end
|
105
|
-
|
106
|
-
# Assert
|
107
|
-
lambda{ @visitor.visit_background(background) }.should_not raise_error
|
108
|
-
background.should be_failed
|
109
|
-
end
|
110
|
-
|
111
|
-
end
|
112
51
|
end
|
113
|
-
|
114
52
|
end
|
115
53
|
end
|
@@ -24,9 +24,9 @@ module Cucumber
|
|
24
24
|
%w{1 22 333},
|
25
25
|
%w{4444 55555 666666}
|
26
26
|
])
|
27
|
-
|
27
|
+
py_string = Ast::PyString.new(%{\n I like\nCucumber sandwich\n})
|
28
28
|
|
29
|
-
background = Ast::Background.new(Ast::Comment.new(""), 2, "Background:", "",
|
29
|
+
background = Ast::Background.new(Ast::Comment.new(""), 2, "Background:", "",
|
30
30
|
[
|
31
31
|
Step.new(3, "Given", "a passing step")
|
32
32
|
]
|
@@ -38,16 +38,15 @@ module Cucumber
|
|
38
38
|
Ast::Tags.new(6, ['one', 'two']),
|
39
39
|
"Feature",
|
40
40
|
"Pretty printing",
|
41
|
-
"",
|
42
41
|
[Ast::Scenario.new(
|
43
42
|
background,
|
44
43
|
Ast::Comment.new(" # My scenario comment \n# On two lines \n"),
|
45
44
|
Ast::Tags.new(8, ['three', 'four']),
|
46
45
|
9,
|
47
|
-
"Scenario:", "A Scenario",
|
46
|
+
"Scenario:", "A Scenario",
|
48
47
|
[
|
49
48
|
Step.new(10, "Given", "a passing step with an inline arg:", table),
|
50
|
-
Step.new(11, "Given", "a happy step with an inline arg:",
|
49
|
+
Step.new(11, "Given", "a happy step with an inline arg:", py_string),
|
51
50
|
Step.new(12, "Given", "a failing step")
|
52
51
|
]
|
53
52
|
)]
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require 'spec_helper'
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
|
2
2
|
require 'cucumber/ast/feature_factory'
|
3
3
|
|
4
4
|
module Cucumber
|
@@ -7,7 +7,7 @@ module Cucumber
|
|
7
7
|
include FeatureFactory
|
8
8
|
|
9
9
|
it "should convert to sexp" do
|
10
|
-
step_mother = Cucumber::
|
10
|
+
step_mother = Cucumber::StepMother.new
|
11
11
|
step_mother.load_programming_language('rb')
|
12
12
|
dsl = Object.new
|
13
13
|
dsl.extend Cucumber::RbSupport::RbDsl
|
@@ -40,12 +40,12 @@ module Cucumber
|
|
40
40
|
[:row, -1,
|
41
41
|
[:cell, "4444"], [:cell, "55555"], [:cell, "666666"]]]],
|
42
42
|
[:step_invocation, 11, "Given", "a happy step with an inline arg:",
|
43
|
-
[:
|
43
|
+
[:py_string, "\n I like\nCucumber sandwich\n"]],
|
44
44
|
[:step_invocation, 12, "Given", "a failing step"]]]
|
45
45
|
end
|
46
46
|
|
47
47
|
it "should store OS specific file paths" do
|
48
|
-
step_mother = Cucumber::
|
48
|
+
step_mother = Cucumber::StepMother.new
|
49
49
|
step_mother.load_programming_language('rb')
|
50
50
|
dsl = Object.new
|
51
51
|
dsl.extend Cucumber::RbSupport::RbDsl
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
|
2
|
+
require 'cucumber/ast/py_string'
|
3
|
+
|
4
|
+
module Cucumber
|
5
|
+
module Ast
|
6
|
+
describe PyString do
|
7
|
+
describe "replacing arguments" do
|
8
|
+
|
9
|
+
before(:each) do
|
10
|
+
@ps = PyString.new("<book>\n<qty>\n")
|
11
|
+
end
|
12
|
+
|
13
|
+
it "should return a new py_string with arguments replaced with values" do
|
14
|
+
py_string_with_replaced_arg = @ps.arguments_replaced({'<book>' => 'Life is elsewhere', '<qty>' => '5'})
|
15
|
+
|
16
|
+
py_string_with_replaced_arg.to_step_definition_arg.should == "Life is elsewhere\n5\n"
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should not change the original py_string" do
|
20
|
+
py_string_with_replaced_arg = @ps.arguments_replaced({'<book>' => 'Life is elsewhere'})
|
21
|
+
|
22
|
+
@ps.to_s.should_not include("Life is elsewhere")
|
23
|
+
end
|
24
|
+
|
25
|
+
it "should replaced nil with empty string" do
|
26
|
+
ps = PyString.new("'<book>'")
|
27
|
+
py_string_with_replaced_arg = ps.arguments_replaced({'<book>' => nil})
|
28
|
+
|
29
|
+
py_string_with_replaced_arg.to_step_definition_arg.should == "''"
|
30
|
+
end
|
31
|
+
|
32
|
+
it "should recognise when just a subset of a cell is delimited" do
|
33
|
+
@ps.should have_text('<qty>')
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require 'spec_helper'
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
|
2
2
|
require 'cucumber/step_mother'
|
3
3
|
require 'cucumber/ast'
|
4
4
|
require 'cucumber/core_ext/string'
|
@@ -8,7 +8,7 @@ module Cucumber
|
|
8
8
|
module Ast
|
9
9
|
describe ScenarioOutline do
|
10
10
|
before do
|
11
|
-
@step_mother = Cucumber::
|
11
|
+
@step_mother = Cucumber::StepMother.new
|
12
12
|
@step_mother.load_programming_language('rb')
|
13
13
|
@dsl = Object.new
|
14
14
|
@dsl.extend(Cucumber::RbSupport::RbDsl)
|
@@ -31,7 +31,7 @@ module Cucumber
|
|
31
31
|
Comment.new(""),
|
32
32
|
Tags.new(18, []),
|
33
33
|
19,
|
34
|
-
"Scenario:", "My outline",
|
34
|
+
"Scenario:", "My outline",
|
35
35
|
[
|
36
36
|
Step.new(20, 'Given', 'there are <start> cucumbers'),
|
37
37
|
Step.new(21, 'When', 'I eat <eat> cucumbers'),
|
@@ -40,19 +40,15 @@ module Cucumber
|
|
40
40
|
],
|
41
41
|
[
|
42
42
|
[
|
43
|
+
Comment.new("#Mmmm... cucumbers\n"),
|
44
|
+
24,
|
45
|
+
'Examples:',
|
46
|
+
'First table',
|
43
47
|
[
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
'',
|
49
|
-
[
|
50
|
-
%w{start eat left},
|
51
|
-
%w{12 5 7},
|
52
|
-
%w{20 6 14}
|
53
|
-
]
|
54
|
-
],
|
55
|
-
Gherkin::Formatter::Model::Examples.new(nil, nil, nil, nil, nil, nil)
|
48
|
+
%w{start eat left},
|
49
|
+
%w{12 5 7},
|
50
|
+
%w{20 6 14}
|
51
|
+
]
|
56
52
|
]
|
57
53
|
]
|
58
54
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require 'spec_helper'
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
|
2
2
|
require 'cucumber/step_mother'
|
3
3
|
require 'cucumber/ast'
|
4
4
|
require 'cucumber/rb_support/rb_language'
|
@@ -7,7 +7,7 @@ module Cucumber
|
|
7
7
|
module Ast
|
8
8
|
describe Scenario do
|
9
9
|
before do
|
10
|
-
@step_mother = Cucumber::
|
10
|
+
@step_mother = Cucumber::StepMother.new
|
11
11
|
@step_mother.load_programming_language('rb')
|
12
12
|
@dsl = Object.new
|
13
13
|
@dsl.extend(Cucumber::RbSupport::RbDsl)
|
@@ -17,6 +17,7 @@ module Cucumber
|
|
17
17
|
$y = n.to_i
|
18
18
|
end
|
19
19
|
@visitor = TreeWalker.new(@step_mother)
|
20
|
+
@visitor.options = {}
|
20
21
|
end
|
21
22
|
|
22
23
|
it "should skip steps when previous is not passed" do
|
@@ -26,8 +27,7 @@ module Cucumber
|
|
26
27
|
tags=Tags.new(98, []),
|
27
28
|
line=99,
|
28
29
|
keyword="",
|
29
|
-
|
30
|
-
description="",
|
30
|
+
name="",
|
31
31
|
steps=[
|
32
32
|
Step.new(7, "Given", "this is missing"),
|
33
33
|
Step.new(8, "Given", "y is 5")
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require 'spec_helper'
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
|
2
2
|
require 'cucumber/step_mother'
|
3
3
|
require 'cucumber/ast'
|
4
4
|
require 'cucumber/core_ext/string'
|
@@ -48,9 +48,9 @@ module Cucumber
|
|
48
48
|
end
|
49
49
|
|
50
50
|
it "should replace arguments in py string arg" do
|
51
|
-
|
51
|
+
py_string = PyString.new('taste_<taste> color_<color>')
|
52
52
|
|
53
|
-
step = Step.new(1, 'Given', 'a <color> cucumber',
|
53
|
+
step = Step.new(1, 'Given', 'a <color> cucumber', py_string)
|
54
54
|
|
55
55
|
invocation_table = Table.new([
|
56
56
|
%w{color taste},
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# encoding: utf-8
|
2
|
-
require 'spec_helper'
|
2
|
+
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
|
3
3
|
require 'cucumber/ast/table'
|
4
4
|
|
5
5
|
module Cucumber
|
@@ -45,26 +45,11 @@ module Cucumber
|
|
45
45
|
@table.hashes.first[:one].should == '4444'
|
46
46
|
end
|
47
47
|
|
48
|
-
it "should allow
|
48
|
+
it "should allow map'ing columns" do
|
49
49
|
@table.map_column!('one') { |v| v.to_i }
|
50
50
|
@table.hashes.first['one'].should == 4444
|
51
51
|
end
|
52
52
|
|
53
|
-
it "should allow mapping columns and take a symbol as the column name" do
|
54
|
-
@table.map_column!(:one) { |v| v.to_i }
|
55
|
-
@table.hashes.first['one'].should == 4444
|
56
|
-
end
|
57
|
-
|
58
|
-
it "should allow mapping columns and modify the rows as well" do
|
59
|
-
@table.map_column!(:one) { |v| v.to_i }
|
60
|
-
@table.rows.first.should include(4444)
|
61
|
-
@table.rows.first.should_not include('4444')
|
62
|
-
end
|
63
|
-
|
64
|
-
it "should return the row values in order" do
|
65
|
-
@table.rows.first.should == %w{4444 55555 666666}
|
66
|
-
end
|
67
|
-
|
68
53
|
it "should pass silently if a mapped column does not exist in non-strict mode" do
|
69
54
|
lambda {
|
70
55
|
@table.map_column!('two', false) { |v| v.to_i }
|
@@ -77,10 +62,6 @@ module Cucumber
|
|
77
62
|
}.should raise_error('The column named "two" does not exist')
|
78
63
|
end
|
79
64
|
|
80
|
-
it "should return the table" do
|
81
|
-
(@table.map_column!(:one) { |v| v.to_i }).should == @table
|
82
|
-
end
|
83
|
-
|
84
65
|
describe "#match" do
|
85
66
|
before(:each) do
|
86
67
|
@table = Table.new([
|
@@ -354,23 +335,6 @@ module Cucumber
|
|
354
335
|
}
|
355
336
|
end
|
356
337
|
|
357
|
-
it "should detect seemingly identical tables as different" do
|
358
|
-
t1 = Table.new([
|
359
|
-
['X', 'Y'],
|
360
|
-
['2', '1']
|
361
|
-
])
|
362
|
-
t2 = Table.new([
|
363
|
-
['X', 'Y'],
|
364
|
-
[2, 1]
|
365
|
-
])
|
366
|
-
lambda{t1.diff!(t2)}.should raise_error
|
367
|
-
t1.to_s(:indent => 12, :color => false).should == %{
|
368
|
-
| X | Y |
|
369
|
-
| (-) (i) "2" | (-) (i) "1" |
|
370
|
-
| (+) (i) 2 | (+) (i) 1 |
|
371
|
-
}
|
372
|
-
end
|
373
|
-
|
374
338
|
it "should not allow mappings that match more than 1 column" do
|
375
339
|
t1 = Table.new([
|
376
340
|
['Cuke', 'Duke'],
|
@@ -1,9 +1,9 @@
|
|
1
|
-
require 'spec_helper'
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
|
2
2
|
|
3
3
|
module Cucumber::Ast
|
4
4
|
describe TreeWalker do
|
5
5
|
it "should visit features" do
|
6
|
-
tw = TreeWalker.new(nil, [mock('listener', :before_visit_features => nil)])
|
6
|
+
tw = TreeWalker.new(nil, [mock('listener', :before_visit_features => nil)], {})
|
7
7
|
tw.should_not_receive(:warn)
|
8
8
|
tw.visit_features(mock('features', :accept => nil))
|
9
9
|
end
|