kosmas58-cucumber 0.1.99.23 → 0.1.100.5
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +8 -23
- data/Manifest.txt +14 -2
- data/examples/i18n/en-lol/Rakefile +6 -0
- data/examples/i18n/en-lol/features/step_definitions/cucumbrz_steps.rb +16 -0
- data/examples/i18n/en-lol/features/stuffing.feature +8 -0
- data/examples/i18n/en-lol/features/support/env.rb +8 -0
- data/examples/i18n/en-lol/lib/basket.rb +12 -0
- data/examples/i18n/en-lol/lib/belly.rb +11 -0
- data/examples/i18n/et/features/jagamine.feature +9 -0
- data/examples/jbehave/README.textile +4 -1
- data/examples/jbehave/features/trading.feature +4 -0
- data/examples/jbehave/pom.xml +5 -0
- data/examples/jbehave/src/main/java/cukes/jbehave/examples/trader/scenarios/TraderSteps.java +6 -1
- data/examples/selenium/features/step_definitons/search_steps.rb +13 -0
- data/examples/selenium/features/support/env.rb +19 -0
- data/examples/selenium_webrat/Rakefile +6 -0
- data/examples/selenium_webrat/features/search.feature +9 -0
- data/examples/selenium_webrat/features/step_definitons/search_steps.rb +13 -0
- data/examples/selenium_webrat/features/support/env.rb +41 -0
- data/examples/self_test/Rakefile +1 -1
- data/examples/self_test/features/background/failing_background.feature +1 -0
- data/examples/self_test/features/step_definitions/sample_steps.rb +1 -1
- data/examples/self_test/features/support/tag_count_formatter.rb +1 -1
- data/examples/tickets/Rakefile +13 -8
- data/examples/tickets/cucumber.yml +2 -1
- data/examples/tickets/features/236.feature +13 -0
- data/examples/tickets/features/241.feature +13 -0
- data/examples/tickets/features/step_definitons/tickets_steps.rb +17 -4
- data/examples/tickets/features/tickets.feature +1 -1
- data/features/background.feature +9 -11
- data/features/cucumber_cli.feature +24 -1
- data/features/cucumber_cli_outlines.feature +10 -19
- data/features/report_called_undefined_steps.feature +2 -0
- data/gem_tasks/rspec.rake +3 -2
- data/lib/cucumber.rb +7 -15
- data/lib/cucumber/ast.rb +3 -3
- data/lib/cucumber/ast/background.rb +28 -66
- data/lib/cucumber/ast/examples.rb +15 -3
- data/lib/cucumber/ast/feature.rb +20 -24
- data/lib/cucumber/ast/feature_element.rb +46 -0
- data/lib/cucumber/ast/features.rb +2 -21
- data/lib/cucumber/ast/outline_table.rb +46 -14
- data/lib/cucumber/ast/py_string.rb +9 -3
- data/lib/cucumber/ast/scenario.rb +34 -73
- data/lib/cucumber/ast/scenario_outline.rb +40 -42
- data/lib/cucumber/ast/step.rb +51 -90
- data/lib/cucumber/ast/step_collection.rb +66 -0
- data/lib/cucumber/ast/step_invocation.rb +110 -0
- data/lib/cucumber/ast/table.rb +41 -21
- data/lib/cucumber/ast/tags.rb +4 -11
- data/lib/cucumber/ast/visitor.rb +35 -19
- data/lib/cucumber/broadcaster.rb +1 -3
- data/lib/cucumber/cli/configuration.rb +25 -17
- data/lib/cucumber/cli/language_help_formatter.rb +4 -4
- data/lib/cucumber/cli/main.rb +6 -4
- data/lib/cucumber/core_ext/proc.rb +2 -2
- data/lib/cucumber/formatter/ansicolor.rb +0 -1
- data/lib/cucumber/formatter/console.rb +24 -34
- data/lib/cucumber/formatter/html.rb +18 -11
- data/lib/cucumber/formatter/pretty.rb +48 -36
- data/lib/cucumber/formatter/profile.rb +6 -6
- data/lib/cucumber/formatter/progress.rb +14 -22
- data/lib/cucumber/formatter/rerun.rb +6 -6
- data/lib/cucumber/jbehave.rb +21 -26
- data/lib/cucumber/languages.yml +17 -2
- data/lib/cucumber/parser/feature.rb +26 -29
- data/lib/cucumber/parser/feature.tt +17 -12
- data/lib/cucumber/parser/treetop_ext.rb +13 -13
- data/lib/cucumber/platform.rb +0 -1
- data/lib/cucumber/rails/world.rb +2 -2
- data/lib/cucumber/rake/task.rb +1 -2
- data/lib/cucumber/step_definition.rb +21 -12
- data/lib/cucumber/step_match.rb +49 -0
- data/lib/cucumber/step_mother.rb +100 -80
- data/lib/cucumber/version.rb +2 -2
- data/lib/cucumber/world.rb +53 -0
- data/rails_generators/cucumber/templates/paths.rb +1 -1
- data/rails_generators/cucumber/templates/webrat_steps.rb +17 -17
- data/rails_generators/feature/feature_generator.rb +5 -1
- data/rails_generators/feature/templates/steps.erb +0 -4
- data/spec/cucumber/ast/background_spec.rb +32 -41
- data/spec/cucumber/ast/feature_factory.rb +10 -1
- data/spec/cucumber/ast/feature_spec.rb +7 -30
- data/spec/cucumber/ast/py_string_spec.rb +7 -0
- data/spec/cucumber/ast/scenario_outline_spec.rb +3 -0
- data/spec/cucumber/ast/scenario_spec.rb +8 -25
- data/spec/cucumber/ast/step_collection_spec.rb +8 -0
- data/spec/cucumber/ast/step_spec.rb +49 -28
- data/spec/cucumber/ast/table_spec.rb +13 -3
- data/spec/cucumber/ast/tags_spec.rb +2 -18
- data/spec/cucumber/broadcaster_spec.rb +6 -5
- data/spec/cucumber/cli/configuration_spec.rb +7 -0
- data/spec/cucumber/cli/main_spec.rb +1 -1
- data/spec/cucumber/parser/feature_parser_spec.rb +6 -5
- data/spec/cucumber/step_definition_spec.rb +16 -5
- data/spec/cucumber/step_mother_spec.rb +6 -6
- data/spec/cucumber/world/pending_spec.rb +1 -1
- metadata +24 -5
- data/lib/cucumber/ast/filter.rb +0 -22
- data/lib/cucumber/ast/steps.rb +0 -13
data/lib/cucumber/version.rb
CHANGED
@@ -0,0 +1,53 @@
|
|
1
|
+
module Cucumber
|
2
|
+
# All steps are run in the context of an object that extends this module
|
3
|
+
module World
|
4
|
+
class << self
|
5
|
+
def alias_adverb(adverb)
|
6
|
+
alias_method adverb, :__cucumber_invoke
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
attr_writer :__cucumber_step_mother, :__cucumber_visitor, :__cucumber_current_step
|
11
|
+
|
12
|
+
# Call a step from within a step definition
|
13
|
+
def __cucumber_invoke(name, multiline_argument=nil) #:nodoc:
|
14
|
+
begin
|
15
|
+
step_match = @__cucumber_step_mother.step_match(name)
|
16
|
+
step_match.invoke(self, multiline_argument)
|
17
|
+
rescue Exception => e
|
18
|
+
e.nested! if Undefined === e
|
19
|
+
@__cucumber_current_step.exception = e
|
20
|
+
raise e
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def table(text, file=nil, line_offset=0)
|
25
|
+
@table_parser ||= Parser::TableParser.new
|
26
|
+
@table_parser.parse_or_fail(text.strip, file, line_offset)
|
27
|
+
end
|
28
|
+
|
29
|
+
# Output +announcement+ alongside the formatted output.
|
30
|
+
# This is an alternative to using Kernel#puts - it will display
|
31
|
+
# nicer, and in all outputs (in case you use several formatters)
|
32
|
+
#
|
33
|
+
# Beware that the output will be printed *before* the corresponding
|
34
|
+
# step. This is because the step itself will not be printed until
|
35
|
+
# after it has run, so it can be coloured according to its status.
|
36
|
+
def announce(announcement)
|
37
|
+
@__cucumber_visitor.announce(announcement)
|
38
|
+
end
|
39
|
+
|
40
|
+
def pending(message = "TODO")
|
41
|
+
if block_given?
|
42
|
+
begin
|
43
|
+
yield
|
44
|
+
rescue Exception => e
|
45
|
+
raise Pending.new(message)
|
46
|
+
end
|
47
|
+
raise Pending.new("Expected pending '#{message}' to fail. No Error was raised. No longer pending?")
|
48
|
+
else
|
49
|
+
raise Pending.new(message)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -11,25 +11,25 @@ When /^I go to (.+)$/ do |page_name|
|
|
11
11
|
visit path_to(page_name)
|
12
12
|
end
|
13
13
|
|
14
|
-
When /^I press "(
|
14
|
+
When /^I press "([^\"]*)"$/ do |button|
|
15
15
|
click_button(button)
|
16
16
|
end
|
17
17
|
|
18
|
-
When /^I follow "(
|
18
|
+
When /^I follow "([^\"]*)"$/ do |link|
|
19
19
|
click_link(link)
|
20
20
|
end
|
21
21
|
|
22
|
-
When /^I fill in "(
|
22
|
+
When /^I fill in "([^\"]*)" with "([^\"]*)"$/ do |field, value|
|
23
23
|
fill_in(field, :with => value)
|
24
24
|
end
|
25
25
|
|
26
|
-
When /^I select "(
|
26
|
+
When /^I select "([^\"]*)" from "([^\"]*)"$/ do |value, field|
|
27
27
|
select(value, :from => field)
|
28
28
|
end
|
29
29
|
|
30
30
|
# Use this step in conjunction with Rail's datetime_select helper. For example:
|
31
31
|
# When I select "December 25, 2008 10:00" as the date and time
|
32
|
-
When /^I select "(
|
32
|
+
When /^I select "([^\"]*)" as the date and time$/ do |time|
|
33
33
|
select_datetime(time)
|
34
34
|
end
|
35
35
|
|
@@ -42,7 +42,7 @@ end
|
|
42
42
|
# The following steps would fill out the form:
|
43
43
|
# When I select "November 23, 2004 11:20" as the "Preferred" data and time
|
44
44
|
# And I select "November 25, 2004 10:30" as the "Alternative" data and time
|
45
|
-
When /^I select "(
|
45
|
+
When /^I select "([^\"]*)" as the "([^\"]*)" date and time$/ do |datetime, datetime_label|
|
46
46
|
select_datetime(datetime, :from => datetime_label)
|
47
47
|
end
|
48
48
|
|
@@ -50,47 +50,47 @@ end
|
|
50
50
|
# When I select "2:20PM" as the time
|
51
51
|
# Note: Rail's default time helper provides 24-hour time-- not 12 hour time. Webrat
|
52
52
|
# will convert the 2:20PM to 14:20 and then select it.
|
53
|
-
When /^I select "(
|
53
|
+
When /^I select "([^\"]*)" as the time$/ do |time|
|
54
54
|
select_time(time)
|
55
55
|
end
|
56
56
|
|
57
57
|
# Use this step when using multiple time_select helpers on a page or you want to
|
58
58
|
# specify the name of the time on the form. For example:
|
59
59
|
# When I select "7:30AM" as the "Gym" time
|
60
|
-
When /^I select "(
|
60
|
+
When /^I select "([^\"]*)" as the "([^\"]*)" time$/ do |time, time_label|
|
61
61
|
select_time(time, :from => time_label)
|
62
62
|
end
|
63
63
|
|
64
64
|
# Use this step in conjunction with Rail's date_select helper. For example:
|
65
65
|
# When I select "February 20, 1981" as the date
|
66
|
-
When /^I select "(
|
66
|
+
When /^I select "([^\"]*)" as the date$/ do |date|
|
67
67
|
select_date(date)
|
68
68
|
end
|
69
69
|
|
70
70
|
# Use this step when using multiple date_select helpers on one page or
|
71
71
|
# you want to specify the name of the date on the form. For example:
|
72
72
|
# When I select "April 26, 1982" as the "Date of Birth" date
|
73
|
-
When /^I select "(
|
73
|
+
When /^I select "([^\"]*)" as the "([^\"]*)" date$/ do |date, date_label|
|
74
74
|
select_date(date, :from => date_label)
|
75
75
|
end
|
76
76
|
|
77
|
-
When /^I check "(
|
77
|
+
When /^I check "([^\"]*)"$/ do |field|
|
78
78
|
check(field)
|
79
79
|
end
|
80
80
|
|
81
|
-
When /^I uncheck "(
|
81
|
+
When /^I uncheck "([^\"]*)"$/ do |field|
|
82
82
|
uncheck(field)
|
83
83
|
end
|
84
84
|
|
85
|
-
When /^I choose "(
|
85
|
+
When /^I choose "([^\"]*)"$/ do |field|
|
86
86
|
choose(field)
|
87
87
|
end
|
88
88
|
|
89
|
-
When /^I attach the file at "(
|
89
|
+
When /^I attach the file at "([^\"]*)" to "([^\"]*)"$/ do |path, field|
|
90
90
|
attach_file(field, path)
|
91
91
|
end
|
92
92
|
|
93
|
-
Then /^I should see "(
|
93
|
+
Then /^I should see "([^\"]*)"$/ do |text|
|
94
94
|
<% if framework == :rspec -%>
|
95
95
|
response.should contain(text)
|
96
96
|
<% else -%>
|
@@ -98,7 +98,7 @@ Then /^I should see "(.*)"$/ do |text|
|
|
98
98
|
<% end -%>
|
99
99
|
end
|
100
100
|
|
101
|
-
Then /^I should not see "(
|
101
|
+
Then /^I should not see "([^\"]*)"$/ do |text|
|
102
102
|
<% if framework == :rspec -%>
|
103
103
|
response.should_not contain(text)
|
104
104
|
<% else -%>
|
@@ -106,7 +106,7 @@ Then /^I should not see "(.*)"$/ do |text|
|
|
106
106
|
<% end -%>
|
107
107
|
end
|
108
108
|
|
109
|
-
Then /^the "(
|
109
|
+
Then /^the "([^\"]*)" checkbox should be checked$/ do |label|
|
110
110
|
<% if framework == :rspec -%>
|
111
111
|
field_labeled(label).should be_checked
|
112
112
|
<% else -%>
|
@@ -16,7 +16,11 @@ class FeatureGenerator < Rails::Generator::NamedBase
|
|
16
16
|
record do |m|
|
17
17
|
m.directory File.join(@features_path, "step_definitions")
|
18
18
|
m.template "feature.erb", File.join(@features_path, "manage_#{plural_name}.feature")
|
19
|
-
m.template "steps.erb", File.join(@features_path, "step_definitions", "#{singular_name}_steps.rb")
|
19
|
+
m.template "steps.erb", File.join(@features_path, "step_definitions", "#{singular_name}_steps.rb")
|
20
|
+
|
21
|
+
m.gsub_file 'features/support/paths.rb', /root_path/mi do |match|
|
22
|
+
"#{match}\n when /the new #{singular_name} page/\n new_#{singular_name}_path\n"
|
23
|
+
end
|
20
24
|
end
|
21
25
|
end
|
22
26
|
|
@@ -5,53 +5,44 @@ module Cucumber
|
|
5
5
|
module Ast
|
6
6
|
describe Background do
|
7
7
|
|
8
|
-
|
9
|
-
|
8
|
+
before do
|
9
|
+
@step_mother = Object.new
|
10
|
+
@step_mother.extend(StepMother)
|
11
|
+
$x = $y = nil
|
12
|
+
@step_mother.Before do
|
13
|
+
$x = 2
|
14
|
+
end
|
15
|
+
@step_mother.Given /y is (\d+)/ do |n|
|
16
|
+
$y = $x * n.to_i
|
17
|
+
end
|
18
|
+
@visitor = Visitor.new(@step_mother)
|
19
|
+
@visitor.options = {}
|
20
|
+
|
21
|
+
@feature = mock('feature', :visit? => true).as_null_object
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should execute Before blocks before background steps" do
|
10
25
|
background = Background.new(
|
11
|
-
comment=Comment.new(
|
12
|
-
line=
|
26
|
+
comment=Comment.new(''),
|
27
|
+
line=2,
|
13
28
|
keyword="",
|
14
29
|
steps=[
|
15
|
-
|
30
|
+
Step.new(7, "Given", "y is 5")
|
16
31
|
])
|
17
|
-
visitor = mock('visitor', :null_object => true)
|
18
32
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
@background = Background.new(
|
29
|
-
comment=Comment.new(""),
|
30
|
-
line=99,
|
31
|
-
keyword="",
|
32
|
-
steps=[
|
33
|
-
@mock_step
|
34
|
-
])
|
35
|
-
|
36
|
-
@visitor = mock('visitor', :null_object => true)
|
37
|
-
@background.accept(@visitor)
|
38
|
-
end
|
39
|
-
|
40
|
-
it "should execute the steps" do
|
41
|
-
@mock_step.should_receive(:execute_as_new).and_return(mock('executed step', :null_object => true))
|
42
|
-
|
43
|
-
@background.accept(@visitor)
|
44
|
-
end
|
45
|
-
|
46
|
-
it "should visit the background if there was a exception when executing a step" do
|
47
|
-
mock_executed_step = mock('executed step', :null_object => true, :exception => Exception.new)
|
48
|
-
@mock_step.stub!(:execute_as_new).and_return(mock_executed_step)
|
49
|
-
|
50
|
-
@visitor.should_receive(:visit_background).with(@background)
|
33
|
+
scenario = Scenario.new(
|
34
|
+
background,
|
35
|
+
comment=Comment.new(""),
|
36
|
+
tags=Tags.new(98,[]),
|
37
|
+
line=99,
|
38
|
+
keyword="",
|
39
|
+
name="",
|
40
|
+
steps=[])
|
41
|
+
background.feature = @feature
|
51
42
|
|
52
|
-
|
53
|
-
|
54
|
-
|
43
|
+
@visitor.visit_background(background)
|
44
|
+
$x.should == 2
|
45
|
+
$y.should == 10
|
55
46
|
end
|
56
47
|
end
|
57
48
|
end
|
@@ -29,11 +29,20 @@ module Cucumber
|
|
29
29
|
I like
|
30
30
|
Cucumber sandwich
|
31
31
|
}, 10)
|
32
|
+
|
33
|
+
background = Ast::Background.new(Ast::Comment.new(""), 2, "Background:",
|
34
|
+
[
|
35
|
+
Step.new(3, "Given", "a passing step")
|
36
|
+
]
|
37
|
+
)
|
38
|
+
|
32
39
|
f = Ast::Feature.new(
|
40
|
+
background,
|
33
41
|
Ast::Comment.new("# My feature comment\n"),
|
34
42
|
Ast::Tags.new(6, ['one', 'two']),
|
35
43
|
"Pretty printing",
|
36
44
|
[Ast::Scenario.new(
|
45
|
+
background,
|
37
46
|
Ast::Comment.new(" # My scenario comment \n# On two lines \n"),
|
38
47
|
Ast::Tags.new(8, ['three', 'four']),
|
39
48
|
9,
|
@@ -46,7 +55,7 @@ module Cucumber
|
|
46
55
|
)]
|
47
56
|
)
|
48
57
|
f.file = 'features/pretty_printing.feature'
|
49
|
-
f.features = Features.new
|
58
|
+
f.features = Features.new
|
50
59
|
f
|
51
60
|
end
|
52
61
|
end
|
@@ -14,46 +14,23 @@ module Cucumber
|
|
14
14
|
[:comment, "# My feature comment\n"],
|
15
15
|
[:tag, "one"],
|
16
16
|
[:tag, "two"],
|
17
|
+
[:background, 2, 'Background:',
|
18
|
+
[:step, 3, "Given", "a passing step"]],
|
17
19
|
[:scenario, 9, "Scenario:",
|
18
20
|
"A Scenario",
|
19
21
|
[:comment, " # My scenario comment \n# On two lines \n"],
|
20
22
|
[:tag, "three"],
|
21
|
-
[:tag, "four"],
|
22
|
-
[:
|
23
|
+
[:tag, "four"],
|
24
|
+
[:step_invocation, 3, "Given", "a passing step"], # From the background
|
25
|
+
[:step_invocation, 10, "Given", "a passing step with an inline arg:",
|
23
26
|
[:table,
|
24
27
|
[:row,
|
25
28
|
[:cell, "1"], [:cell, "22"], [:cell, "333"]],
|
26
29
|
[:row,
|
27
30
|
[:cell, "4444"], [:cell, "55555"], [:cell, "666666"]]]],
|
28
|
-
[:
|
31
|
+
[:step_invocation, 11, "Given", "a happy step with an inline arg:",
|
29
32
|
[:py_string, "\n I like\nCucumber sandwich\n"]],
|
30
|
-
[:
|
31
|
-
end
|
32
|
-
|
33
|
-
it "should only visit scenarios that match" do
|
34
|
-
s1 = mock("Scenario 1")
|
35
|
-
s2 = mock("Scenario 2")
|
36
|
-
s3 = mock("Scenario 3")
|
37
|
-
[s1, s2, s3].each{|s| s.should_receive(:feature=)}
|
38
|
-
f = Ast::Feature.new(
|
39
|
-
Ast::Comment.new(""),
|
40
|
-
Ast::Tags.new(22, []),
|
41
|
-
"My feature",
|
42
|
-
[s1, s2, s3]
|
43
|
-
)
|
44
|
-
features = mock('Features')
|
45
|
-
f.features = features
|
46
|
-
|
47
|
-
f.lines = [33]
|
48
|
-
|
49
|
-
features.should_receive(:visit?).with(s1, [33]).and_return(false)
|
50
|
-
features.should_receive(:visit?).with(s2, [33]).and_return(true)
|
51
|
-
features.should_receive(:visit?).with(s3, [33]).and_return(false)
|
52
|
-
|
53
|
-
s2.should_receive(:accept)
|
54
|
-
|
55
|
-
visitor = Visitor.new(nil)
|
56
|
-
visitor.visit_feature(f)
|
33
|
+
[:step_invocation, 12, "Given", "a failing step"]]]
|
57
34
|
end
|
58
35
|
end
|
59
36
|
end
|
@@ -33,6 +33,13 @@ module Cucumber
|
|
33
33
|
@ps.to_s.should_not include("Life is elsewhere")
|
34
34
|
end
|
35
35
|
|
36
|
+
it "should replaced nil with empty string" do
|
37
|
+
ps = PyString.new(10, 13, "'<book>'", 0)
|
38
|
+
py_string_with_replaced_arg = ps.arguments_replaced({'<book>' => nil})
|
39
|
+
|
40
|
+
py_string_with_replaced_arg.to_s.should == "''"
|
41
|
+
end
|
42
|
+
|
36
43
|
end
|
37
44
|
|
38
45
|
end
|
@@ -9,6 +9,7 @@ module Cucumber
|
|
9
9
|
before do
|
10
10
|
@step_mother = Object.new
|
11
11
|
@step_mother.extend(StepMother)
|
12
|
+
|
12
13
|
@step_mother.Given(/^there are (\d+) cucumbers$/) do |n|
|
13
14
|
@initial = n.to_i
|
14
15
|
end
|
@@ -23,6 +24,7 @@ module Cucumber
|
|
23
24
|
end
|
24
25
|
|
25
26
|
@scenario_outline = ScenarioOutline.new(
|
27
|
+
background=nil,
|
26
28
|
Comment.new(""),
|
27
29
|
Tags.new(18, []),
|
28
30
|
19,
|
@@ -45,6 +47,7 @@ module Cucumber
|
|
45
47
|
]
|
46
48
|
]
|
47
49
|
]
|
50
|
+
|
48
51
|
)
|
49
52
|
end
|
50
53
|
|
@@ -9,9 +9,6 @@ module Cucumber
|
|
9
9
|
@step_mother = Object.new
|
10
10
|
@step_mother.extend(StepMother)
|
11
11
|
$x = $y = nil
|
12
|
-
@step_mother.Before do
|
13
|
-
$x = 3
|
14
|
-
end
|
15
12
|
@step_mother.Given /y is (\d+)/ do |n|
|
16
13
|
$y = n.to_i
|
17
14
|
end
|
@@ -19,23 +16,9 @@ module Cucumber
|
|
19
16
|
@visitor.options = {}
|
20
17
|
end
|
21
18
|
|
22
|
-
it "should execute Before blocks before steps" do
|
23
|
-
scenario = Scenario.new(
|
24
|
-
comment=Comment.new(""),
|
25
|
-
tags=Tags.new(98,[]),
|
26
|
-
line=99,
|
27
|
-
keyword="",
|
28
|
-
name="",
|
29
|
-
steps=[
|
30
|
-
Step.new(7, "Given", "y is 5")
|
31
|
-
])
|
32
|
-
@visitor.visit_feature_element(scenario)
|
33
|
-
$x.should == 3
|
34
|
-
$y.should == 5
|
35
|
-
end
|
36
|
-
|
37
19
|
it "should skip steps when previous is not passed" do
|
38
20
|
scenario = Scenario.new(
|
21
|
+
background=nil,
|
39
22
|
comment=Comment.new(""),
|
40
23
|
tags=Tags.new(98, []),
|
41
24
|
line=99,
|
@@ -47,20 +30,20 @@ module Cucumber
|
|
47
30
|
])
|
48
31
|
@visitor.visit_feature_element(scenario)
|
49
32
|
|
50
|
-
$x.should == 3
|
51
33
|
$y.should == nil
|
52
34
|
end
|
53
35
|
|
54
36
|
it "should be at exact line" do
|
55
|
-
s = Scenario.new(comment=Comment.new(""),
|
37
|
+
s = Scenario.new(background=nil, comment=Comment.new(""),
|
56
38
|
tags=Tags.new(44, []), 45, keyword="", name="", steps=[])
|
57
39
|
|
58
|
-
s.should
|
59
|
-
s.should
|
40
|
+
s.should be_matches_lines([44])
|
41
|
+
s.should be_matches_lines([45])
|
60
42
|
end
|
61
43
|
|
62
44
|
it "should be at line if tags or steps are" do
|
63
45
|
s = Scenario.new(
|
46
|
+
background=nil,
|
64
47
|
comment=Comment.new(""),
|
65
48
|
tags=Tags.new(43, []),
|
66
49
|
line=45,
|
@@ -73,9 +56,9 @@ module Cucumber
|
|
73
56
|
]
|
74
57
|
)
|
75
58
|
|
76
|
-
s.should
|
77
|
-
s.should
|
78
|
-
s.should_not
|
59
|
+
s.should be_matches_lines([43])
|
60
|
+
s.should be_matches_lines([47])
|
61
|
+
s.should_not be_matches_lines([49])
|
79
62
|
end
|
80
63
|
end
|
81
64
|
end
|