cucumber 0.2.3 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +56 -1
- data/Manifest.txt +70 -49
- data/config/hoe.rb +1 -1
- data/cucumber.yml +1 -1
- data/examples/i18n/bg/Rakefile +6 -0
- data/examples/i18n/bg/features/addition.feature +11 -0
- data/examples/i18n/bg/features/consecutive_calculations.feature +18 -0
- data/examples/i18n/bg/features/division.feature +16 -0
- data/examples/i18n/bg/features/step_definitons/calculator_steps.rb +24 -0
- data/examples/i18n/bg/features/support/env.rb +6 -0
- data/examples/i18n/bg/features/support/world.rb +8 -0
- data/examples/i18n/bg/lib/calculator.rb +24 -0
- data/examples/i18n/ru/features/support/world.rb +4 -3
- data/examples/i18n/sk/Rakefile +6 -0
- data/examples/i18n/sk/features/addition.feature +16 -0
- data/examples/i18n/sk/features/division.feature +9 -0
- data/examples/i18n/sk/features/step_definitons/calculator_steps.rb +24 -0
- data/examples/i18n/sk/lib/calculator.rb +14 -0
- data/examples/self_test/features/background/background_with_name.feature +7 -0
- data/examples/self_test/features/background/passing_background.feature +2 -2
- data/examples/self_test/features/step_definitions/sample_steps.rb +18 -2
- data/examples/self_test/features/undefined_multiline_args.feature +12 -0
- data/examples/sinatra/features/support/env.rb +2 -6
- data/examples/test_unit/features/step_definitions/test_unit_steps.rb +1 -4
- data/examples/tickets/Rakefile +1 -1
- data/examples/tickets/features/229/tagged_hooks.feature +8 -0
- data/examples/tickets/features/229/tagged_hooks.rb +14 -0
- data/examples/tickets/features/270/back.feature +14 -0
- data/examples/tickets/features/270/back.steps.rb +14 -0
- data/examples/tickets/features/279/py_string_indent.feature +25 -0
- data/examples/tickets/features/279/py_string_indent.steps.rb +12 -0
- data/examples/tickets/features/279/wrong.feature_ +11 -0
- data/examples/tickets/features/step_definitons/tickets_steps.rb +0 -7
- data/features/background.feature +21 -3
- data/features/cucumber_cli.feature +18 -5
- data/features/cucumber_cli_outlines.feature +4 -1
- data/features/rake_task.feature +132 -0
- data/features/snippet.feature +23 -0
- data/features/step_definitions/cucumber_steps.rb +46 -15
- data/features/support/env.rb +61 -4
- data/features/usage.feature +5 -0
- data/gem_tasks/deployment.rake +1 -1
- data/lib/cucumber/ast/background.rb +14 -4
- data/lib/cucumber/ast/examples.rb +0 -12
- data/lib/cucumber/ast/feature.rb +2 -12
- data/lib/cucumber/ast/feature_element.rb +4 -8
- data/lib/cucumber/ast/features.rb +1 -1
- data/lib/cucumber/ast/outline_table.rb +20 -20
- data/lib/cucumber/ast/py_string.rb +6 -11
- data/lib/cucumber/ast/scenario.rb +1 -8
- data/lib/cucumber/ast/scenario_outline.rb +1 -11
- data/lib/cucumber/ast/step.rb +3 -9
- data/lib/cucumber/ast/step_collection.rb +0 -4
- data/lib/cucumber/ast/step_invocation.rb +5 -6
- data/lib/cucumber/ast/table.rb +5 -22
- data/lib/cucumber/ast/tags.rb +9 -9
- data/lib/cucumber/ast/visitor.rb +12 -25
- data/lib/cucumber/cli/configuration.rb +4 -4
- data/lib/cucumber/cli/main.rb +10 -3
- data/lib/cucumber/core_ext/instance_exec.rb +17 -4
- data/lib/cucumber/formatter/ansicolor.rb +1 -1
- data/lib/cucumber/formatter/console.rb +2 -1
- data/lib/cucumber/formatter/html.rb +21 -7
- data/lib/cucumber/formatter/pretty.rb +27 -20
- data/lib/cucumber/formatter/usage.rb +16 -0
- data/lib/cucumber/languages.yml +23 -5
- data/lib/cucumber/parser/feature.rb +231 -114
- data/lib/cucumber/parser/feature.tt +120 -25
- data/lib/cucumber/parser/table.rb +37 -25
- data/lib/cucumber/parser/table.tt +15 -3
- data/lib/cucumber/parser/treetop_ext.rb +48 -9
- data/lib/cucumber/rake/task.rb +29 -6
- data/lib/cucumber/step_definition.rb +4 -2
- data/lib/cucumber/step_mother.rb +143 -26
- data/lib/cucumber/version.rb +2 -2
- data/rails_generators/cucumber/templates/paths.rb +13 -4
- data/rails_generators/cucumber/templates/webrat_steps.rb +16 -0
- data/{specs → spec}/cucumber/ast/background_spec.rb +1 -0
- data/{specs → spec}/cucumber/ast/feature_factory.rb +1 -1
- data/{specs → spec}/cucumber/ast/feature_spec.rb +2 -2
- data/{specs → spec}/cucumber/ast/py_string_spec.rb +0 -0
- data/{specs → spec}/cucumber/ast/scenario_outline_spec.rb +0 -0
- data/{specs → spec}/cucumber/ast/scenario_spec.rb +0 -27
- data/{specs → spec}/cucumber/ast/step_collection_spec.rb +0 -0
- data/{specs → spec}/cucumber/ast/step_spec.rb +0 -0
- data/{specs → spec}/cucumber/ast/table_spec.rb +2 -2
- data/{specs → spec}/cucumber/broadcaster_spec.rb +0 -0
- data/{specs → spec}/cucumber/cli/configuration_spec.rb +0 -0
- data/{specs → spec}/cucumber/cli/main_spec.rb +5 -1
- data/spec/cucumber/core_ext/proc_spec.rb +54 -0
- data/{specs → spec}/cucumber/core_ext/string_spec.rb +0 -0
- data/{specs → spec}/cucumber/formatter/ansicolor_spec.rb +0 -0
- data/{specs → spec}/cucumber/formatter/color_io_spec.rb +0 -0
- data/{specs → spec}/cucumber/formatter/html/cucumber.css +0 -0
- data/{specs → spec}/cucumber/formatter/html/cucumber.js +0 -0
- data/{specs → spec}/cucumber/formatter/html/index.html +0 -0
- data/{specs → spec}/cucumber/formatter/html/jquery-1.3.min.js +0 -0
- data/{specs → spec}/cucumber/formatter/html/jquery.uitableedit.js +0 -0
- data/{specs → spec}/cucumber/formatters/profile_formatter_spec.rb +0 -0
- data/{specs → spec}/cucumber/parser/feature_parser_spec.rb +43 -41
- data/{specs → spec}/cucumber/parser/table_parser_spec.rb +0 -0
- data/{specs → spec}/cucumber/rails/stubs/mini_rails.rb +0 -0
- data/{specs → spec}/cucumber/rails/stubs/test_help.rb +0 -0
- data/{specs → spec}/cucumber/rails/world_spec.rb +0 -0
- data/{specs → spec}/cucumber/sell_cucumbers.feature +0 -0
- data/{specs → spec}/cucumber/step_definition_spec.rb +0 -0
- data/{specs → spec}/cucumber/step_mother_spec.rb +63 -4
- data/{specs → spec}/cucumber/treetop_parser/empty_feature.feature +0 -0
- data/{specs → spec}/cucumber/treetop_parser/empty_scenario.feature +0 -0
- data/{specs → spec}/cucumber/treetop_parser/empty_scenario_outline.feature +0 -0
- data/{specs → spec}/cucumber/treetop_parser/fit_scenario.feature +0 -0
- data/{specs → spec}/cucumber/treetop_parser/given_scenario.feature +0 -0
- data/{specs → spec}/cucumber/treetop_parser/invalid_scenario_outlines.feature +0 -0
- data/{specs → spec}/cucumber/treetop_parser/multiline_steps.feature +0 -0
- data/{specs → spec}/cucumber/treetop_parser/multiple_tables.feature +0 -0
- data/{specs → spec}/cucumber/treetop_parser/scenario_outline.feature +0 -0
- data/{specs → spec}/cucumber/treetop_parser/spaces.feature +0 -0
- data/{specs → spec}/cucumber/treetop_parser/test_dos.feature +0 -0
- data/{specs → spec}/cucumber/treetop_parser/with_comments.feature +0 -0
- data/{specs → spec}/cucumber/treetop_parser/with_tags.feature +0 -0
- data/{specs → spec}/cucumber/world/pending_spec.rb +0 -0
- data/{specs → spec}/spec.opts +0 -0
- data/{specs → spec}/spec_helper.rb +2 -11
- metadata +72 -51
- data/examples/tickets/cucumber.yml +0 -3
- data/lib/cucumber/parser/basic.rb +0 -0
- data/specs/cucumber/ast/tags_spec.rb +0 -19
- data/specs/cucumber/core_ext/proc_spec.rb +0 -37
@@ -0,0 +1,23 @@
|
|
1
|
+
Feature: Snippets
|
2
|
+
In order to help speed up writing step definitions
|
3
|
+
As a feature editor
|
4
|
+
I want snippet suggestions for undefined step definitions
|
5
|
+
|
6
|
+
Scenario: Snippet for undefined step with a pystring
|
7
|
+
When I run cucumber features/undefined_multiline_args.feature:3 -n
|
8
|
+
Then the output should contain
|
9
|
+
"""
|
10
|
+
Given /^a pystring$/ do |string|
|
11
|
+
# string is a Cucumber::Ast::PyString
|
12
|
+
pending
|
13
|
+
end
|
14
|
+
"""
|
15
|
+
Scenario: Snippet for undefined step with a step table
|
16
|
+
When I run cucumber features/undefined_multiline_args.feature:9 -n
|
17
|
+
Then the output should contain
|
18
|
+
"""
|
19
|
+
Given /^a table$/ do |table|
|
20
|
+
# table is a Cucumber::Ast::Table
|
21
|
+
pending
|
22
|
+
end
|
23
|
+
"""
|
@@ -1,30 +1,61 @@
|
|
1
|
-
Given /^I am in (.*)$/ do |
|
2
|
-
@
|
1
|
+
Given /^I am in (.*)$/ do |example_dir_relative_path|
|
2
|
+
@current_dir = examples_dir(example_dir_relative_path)
|
3
3
|
end
|
4
4
|
|
5
|
-
|
6
|
-
@
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
@out = `#{@full_cmd}`
|
11
|
-
@status = $?.exitstatus
|
5
|
+
Given /^a standard Cucumber project directory structure$/ do
|
6
|
+
@current_dir = working_dir
|
7
|
+
in_current_dir do
|
8
|
+
FileUtils.mkdir_p 'features/support'
|
9
|
+
FileUtils.mkdir 'features/step_definitions'
|
12
10
|
end
|
13
11
|
end
|
14
12
|
|
15
|
-
|
16
|
-
|
13
|
+
Given /^a file named "([^\"]*)" with:$/ do |file_name, file_content|
|
14
|
+
create_file(file_name, file_content)
|
15
|
+
end
|
16
|
+
|
17
|
+
Given /^the following profiles? (?:are|is) defined:$/ do |profiles|
|
18
|
+
create_file('cucumber.yml', profiles)
|
19
|
+
end
|
20
|
+
|
21
|
+
When /^I run cucumber (.*)$/ do |cucumber_opts|
|
22
|
+
run "#{Cucumber::RUBY_BINARY} #{Cucumber::BINARY} --no-color #{cucumber_opts}"
|
23
|
+
end
|
24
|
+
|
25
|
+
When /^I run rake (.*)$/ do |rake_opts|
|
26
|
+
run "rake #{rake_opts}"
|
27
|
+
end
|
28
|
+
|
29
|
+
Then /^it should (fail|pass)$/ do |success|
|
17
30
|
if success == 'fail'
|
18
|
-
|
31
|
+
last_exit_status.should_not == 0
|
19
32
|
else
|
20
|
-
|
33
|
+
last_exit_status.should == 0
|
21
34
|
end
|
22
35
|
end
|
23
36
|
|
24
|
-
Then /^(
|
37
|
+
Then /^it should (fail|pass) with$/ do |success, output|
|
38
|
+
last_stdout.should == output
|
39
|
+
Then("it should #{success}")
|
40
|
+
end
|
41
|
+
|
42
|
+
Then /^the output should contain$/ do |text|
|
43
|
+
last_stdout.should include(text)
|
44
|
+
end
|
45
|
+
|
46
|
+
Then /^"(.*)" should contain$/ do |file, text|
|
25
47
|
IO.read(file).should == text
|
26
48
|
end
|
27
49
|
|
28
|
-
Then /^(.*) should match$/ do |file, text|
|
50
|
+
Then /^"(.*)" should match$/ do |file, text|
|
29
51
|
IO.read(file).should =~ Regexp.new(text)
|
30
52
|
end
|
53
|
+
|
54
|
+
Then /^STDERR should match$/ do |text|
|
55
|
+
last_stderr.should =~ /#{text}/
|
56
|
+
end
|
57
|
+
|
58
|
+
Then /^"(.*)" should exist$/ do |file|
|
59
|
+
File.exists?(file).should be_true
|
60
|
+
FileUtils.rm(file)
|
61
|
+
end
|
data/features/support/env.rb
CHANGED
@@ -1,8 +1,65 @@
|
|
1
1
|
require 'rubygems'
|
2
|
+
require 'tempfile'
|
2
3
|
require 'spec/expectations'
|
3
4
|
require 'fileutils'
|
5
|
+
require 'forwardable'
|
4
6
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
7
|
+
class CucumberWorld
|
8
|
+
extend Forwardable
|
9
|
+
def_delegators CucumberWorld, :examples_dir, :self_test_dir, :working_dir, :cucumber_lib_dir
|
10
|
+
|
11
|
+
def self.examples_dir(subdir=nil)
|
12
|
+
@examples_dir ||= File.expand_path(File.join(File.dirname(__FILE__), '../../examples'))
|
13
|
+
subdir ? File.join(@examples_dir, subdir) : @examples_dir
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.self_test_dir
|
17
|
+
@self_test_dir ||= examples_dir('self_test')
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.working_dir
|
21
|
+
@working_dir ||= examples_dir('self_test/tmp')
|
22
|
+
end
|
23
|
+
|
24
|
+
def cucumber_lib_dir
|
25
|
+
@cucumber_lib_dir ||= File.expand_path(File.join(File.dirname(__FILE__), '../../lib'))
|
26
|
+
end
|
27
|
+
|
28
|
+
def initialize
|
29
|
+
@current_dir = self_test_dir
|
30
|
+
end
|
31
|
+
|
32
|
+
private
|
33
|
+
attr_reader :last_exit_status, :last_stdout, :last_stderr
|
34
|
+
|
35
|
+
def create_file(file_name, file_content)
|
36
|
+
file_content.gsub!("CUCUMBER_LIB", "'#{cucumber_lib_dir}'") # Some files, such as Rakefiles need to use the lib dir
|
37
|
+
in_current_dir do
|
38
|
+
File.open(file_name, 'w') { |f| f << file_content }
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def in_current_dir(&block)
|
43
|
+
Dir.chdir(@current_dir, &block)
|
44
|
+
end
|
45
|
+
|
46
|
+
def run(command)
|
47
|
+
stderr_file = Tempfile.new('cucumber')
|
48
|
+
stderr_file.close
|
49
|
+
in_current_dir do
|
50
|
+
@last_stdout = `#{command} 2> #{stderr_file.path}`
|
51
|
+
@last_exit_status = $?.exitstatus
|
52
|
+
end
|
53
|
+
@last_stderr = IO.read(stderr_file.path)
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
57
|
+
|
58
|
+
World do
|
59
|
+
CucumberWorld.new
|
60
|
+
end
|
61
|
+
|
62
|
+
Before do
|
63
|
+
FileUtils.rm_rf CucumberWorld.working_dir
|
64
|
+
FileUtils.mkdir CucumberWorld.working_dir
|
65
|
+
end
|
data/features/usage.feature
CHANGED
@@ -19,6 +19,7 @@ Feature: Cucumber command line
|
|
19
19
|
/^call step "(.*)"$/ # features/step_definitions/sample_steps.rb:23
|
20
20
|
Given call step "a step definition that calls an undefined step" # features/call_undefined_step_from_step_def.feature:7
|
21
21
|
/^'(.+)' cukes$/ # features/step_definitions/sample_steps.rb:27
|
22
|
+
Given '10' cukes # features/background/background_with_name.feature:4
|
22
23
|
And '10' cukes # features/background/failing_background.feature:5
|
23
24
|
Given '10' cukes # features/background/passing_background.feature:4
|
24
25
|
Given '10' cukes # features/background/scenario_outline_passing_background.feature:4
|
@@ -72,6 +73,7 @@ Feature: Cucumber command line
|
|
72
73
|
Given '2' cukes # features/tons_of_cukes.feature:51
|
73
74
|
Given '2' cukes # features/tons_of_cukes.feature:52
|
74
75
|
/^I should have '(.+)' cukes$/ # features/step_definitions/sample_steps.rb:31
|
76
|
+
Then I should have '10' cukes # features/background/background_with_name.feature:7
|
75
77
|
Then I should have '10' cukes # features/background/failing_background.feature:8
|
76
78
|
Then I should have '10' cukes # features/background/failing_background.feature:11
|
77
79
|
Then I should have '10' cukes # features/background/passing_background.feature:7
|
@@ -103,6 +105,9 @@ Feature: Cucumber command line
|
|
103
105
|
Given failing expectation # features/failing_expectation.feature:4
|
104
106
|
/^failing$/ # features/step_definitions/sample_steps.rb:8
|
105
107
|
Given failing # features/sample.feature:16
|
108
|
+
(::) UNUSED (::)
|
109
|
+
/^unused$/ # features/step_definitions/sample_steps.rb:66
|
110
|
+
/^another unused$/ # features/step_definitions/sample_steps.rb:69
|
106
111
|
|
107
112
|
"""
|
108
113
|
|
data/gem_tasks/deployment.rake
CHANGED
@@ -6,8 +6,8 @@ module Cucumber
|
|
6
6
|
include FeatureElement
|
7
7
|
attr_writer :feature
|
8
8
|
|
9
|
-
def initialize(comment, line, keyword, steps)
|
10
|
-
@comment, @line, @keyword, @steps = comment, line, keyword, StepCollection.new(steps)
|
9
|
+
def initialize(comment, line, keyword, name, steps)
|
10
|
+
@comment, @line, @keyword, @name, @steps = comment, line, keyword, name, StepCollection.new(steps)
|
11
11
|
attach_steps(steps)
|
12
12
|
@step_invocations = @steps.step_invocations(true)
|
13
13
|
end
|
@@ -23,10 +23,20 @@ module Cucumber
|
|
23
23
|
|
24
24
|
def accept(visitor)
|
25
25
|
visitor.visit_comment(@comment)
|
26
|
-
visitor.visit_background_name(@keyword,
|
27
|
-
visitor.step_mother.
|
26
|
+
visitor.visit_background_name(@keyword, @name, file_colon_line(@line), source_indent(text_length))
|
27
|
+
visitor.step_mother.before(self)
|
28
28
|
visitor.visit_steps(@step_invocations)
|
29
29
|
@failed = @step_invocations.detect{|step_invocation| step_invocation.exception}
|
30
|
+
visitor.step_mother.after(self) if @failed
|
31
|
+
end
|
32
|
+
|
33
|
+
def accept_hook?(hook)
|
34
|
+
# TODO: When background is involved - no tag based hook filtering is occurring with
|
35
|
+
# the current implementation. All hooks will be executed. This is because of the line
|
36
|
+
# visitor.step_mother.before(self)
|
37
|
+
# in the #accept method above. Instead, we should really be passing the first scenario
|
38
|
+
# here. We currently don't have access to that, so a refactoring is in order to make that happen.
|
39
|
+
true
|
30
40
|
end
|
31
41
|
|
32
42
|
def failed?
|
@@ -10,26 +10,14 @@ module Cucumber
|
|
10
10
|
visitor.visit_outline_table(@outline_table)
|
11
11
|
end
|
12
12
|
|
13
|
-
def descend?(visitor)
|
14
|
-
@outline_table.descend?(visitor)
|
15
|
-
end
|
16
|
-
|
17
13
|
def skip_invoke!
|
18
14
|
@outline_table.skip_invoke!
|
19
15
|
end
|
20
16
|
|
21
|
-
def matches_scenario_names?(scenario_names)
|
22
|
-
scenario_names.detect{|name| name == @name}
|
23
|
-
end
|
24
|
-
|
25
17
|
def each_example_row(&proc)
|
26
18
|
@outline_table.cells_rows[1..-1].each(&proc)
|
27
19
|
end
|
28
20
|
|
29
|
-
def matches_lines?(lines)
|
30
|
-
lines.index(@line) || @outline_table.matches_lines?(lines)
|
31
|
-
end
|
32
|
-
|
33
21
|
def to_sexp
|
34
22
|
[:examples, @keyword, @name, @outline_table.to_sexp]
|
35
23
|
end
|
data/lib/cucumber/ast/feature.rb
CHANGED
@@ -3,11 +3,10 @@ module Cucumber
|
|
3
3
|
# Represents the root node of a parsed feature.
|
4
4
|
class Feature
|
5
5
|
attr_accessor :file
|
6
|
-
attr_writer :features
|
6
|
+
attr_writer :features
|
7
7
|
|
8
8
|
def initialize(background, comment, tags, name, feature_elements)
|
9
9
|
@background, @comment, @tags, @name, @feature_elements = background, comment, tags, name, feature_elements
|
10
|
-
@lines = []
|
11
10
|
|
12
11
|
@feature_elements.each do |feature_element|
|
13
12
|
feature_element.feature = self
|
@@ -15,24 +14,15 @@ module Cucumber
|
|
15
14
|
end
|
16
15
|
|
17
16
|
def accept(visitor)
|
18
|
-
visitor.current_feature_lines = @lines
|
19
17
|
visitor.visit_comment(@comment)
|
20
18
|
visitor.visit_tags(@tags)
|
21
19
|
visitor.visit_feature_name(@name)
|
22
20
|
visitor.visit_background(@background) if @background
|
23
21
|
@feature_elements.each do |feature_element|
|
24
|
-
visitor.visit_feature_element(feature_element)
|
22
|
+
visitor.visit_feature_element(feature_element)
|
25
23
|
end
|
26
24
|
end
|
27
25
|
|
28
|
-
def descend?(visitor)
|
29
|
-
@feature_elements.detect{ |feature_element| feature_element.descend?(visitor) }
|
30
|
-
end
|
31
|
-
|
32
|
-
def has_tags?(tags)
|
33
|
-
@tags.has_tags?(tags)
|
34
|
-
end
|
35
|
-
|
36
26
|
def next_feature_element(feature_element, &proc)
|
37
27
|
index = @feature_elements.index(feature_element)
|
38
28
|
next_one = @feature_elements[index+1]
|
@@ -12,14 +12,6 @@ module Cucumber
|
|
12
12
|
@keyword.jlength + @name.jlength
|
13
13
|
end
|
14
14
|
|
15
|
-
def matches_lines?(lines)
|
16
|
-
lines.index(@line) || @steps.matches_lines?(lines) || @tags.matches_lines?(lines)
|
17
|
-
end
|
18
|
-
|
19
|
-
def has_tags?(tags)
|
20
|
-
@tags.has_tags?(tags) || @feature.has_tags?(tags)
|
21
|
-
end
|
22
|
-
|
23
15
|
def matches_scenario_names?(scenario_names)
|
24
16
|
scenario_names.detect{|name| name == @name}
|
25
17
|
end
|
@@ -36,6 +28,10 @@ module Cucumber
|
|
36
28
|
@steps.max_line_length(self)
|
37
29
|
end
|
38
30
|
|
31
|
+
def accept_hook?(hook)
|
32
|
+
@tags.accept_hook?(hook)
|
33
|
+
end
|
34
|
+
|
39
35
|
# TODO: Remove when we use StepCollection everywhere
|
40
36
|
def previous_step(step)
|
41
37
|
i = @steps.index(step) || -1
|
@@ -5,45 +5,41 @@ module Cucumber
|
|
5
5
|
super(raw)
|
6
6
|
@scenario_outline = scenario_outline
|
7
7
|
@cells_class = ExampleCells
|
8
|
-
|
9
|
-
cells_rows.each do |cells|
|
10
|
-
cells.create_step_invocations!(scenario_outline)
|
11
|
-
end
|
8
|
+
create_step_invocations_for_example_rows!(scenario_outline)
|
12
9
|
end
|
13
10
|
|
14
11
|
def accept(visitor)
|
15
12
|
cells_rows.each_with_index do |row, n|
|
16
|
-
|
17
|
-
visitor.visit_table_row(row)
|
18
|
-
end
|
13
|
+
visitor.visit_table_row(row)
|
19
14
|
end
|
20
15
|
nil
|
21
16
|
end
|
22
17
|
|
23
|
-
def
|
24
|
-
|
18
|
+
def accept_hook?(hook)
|
19
|
+
@scenario_outline.accept_hook?(hook)
|
25
20
|
end
|
26
|
-
|
27
|
-
def matches?(visitor, cells)
|
28
|
-
@scenario_outline.matches_tags_and_name?(visitor) &&
|
29
|
-
(visitor.matches_lines?(cells) || visitor.matches_lines?(@scenario_outline))
|
30
|
-
end
|
31
|
-
|
21
|
+
|
32
22
|
def skip_invoke!
|
33
|
-
|
23
|
+
example_rows.each do |cells|
|
34
24
|
cells.skip_invoke!
|
35
25
|
end
|
36
26
|
end
|
37
27
|
|
28
|
+
def create_step_invocations_for_example_rows!(scenario_outline)
|
29
|
+
example_rows.each do |cells|
|
30
|
+
cells.create_step_invocations!(scenario_outline)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def example_rows
|
35
|
+
cells_rows[1..-1]
|
36
|
+
end
|
37
|
+
|
38
38
|
class ExampleCells < Cells
|
39
39
|
def create_step_invocations!(scenario_outline)
|
40
40
|
@step_invocations = scenario_outline.step_invocations(self)
|
41
41
|
end
|
42
42
|
|
43
|
-
def descend?(visitor)
|
44
|
-
@table.matches?(visitor, self)
|
45
|
-
end
|
46
|
-
|
47
43
|
def skip_invoke!
|
48
44
|
@step_invocations.each do |step_invocation|
|
49
45
|
step_invocation.skip_invoke!
|
@@ -70,6 +66,10 @@ module Cucumber
|
|
70
66
|
end
|
71
67
|
end
|
72
68
|
|
69
|
+
def accept_hook?(hook)
|
70
|
+
@table.accept_hook?(hook)
|
71
|
+
end
|
72
|
+
|
73
73
|
private
|
74
74
|
|
75
75
|
def header?
|
@@ -17,26 +17,22 @@ module Cucumber
|
|
17
17
|
# Note how the indentation from the source is stripped away.
|
18
18
|
#
|
19
19
|
class PyString
|
20
|
+
|
21
|
+
def self.default_arg_name
|
22
|
+
"string"
|
23
|
+
end
|
24
|
+
|
20
25
|
def initialize(start_line, end_line, string, quotes_indent)
|
21
26
|
@start_line, @end_line = start_line, end_line
|
22
27
|
@string, @quotes_indent = string.gsub(/\\"/, '"'), quotes_indent
|
23
|
-
@status = :passed
|
24
|
-
end
|
25
|
-
|
26
|
-
def status=(status)
|
27
|
-
@status = status
|
28
28
|
end
|
29
29
|
|
30
30
|
def to_s
|
31
31
|
@string.indent(-@quotes_indent)
|
32
32
|
end
|
33
33
|
|
34
|
-
def matches_lines?(lines)
|
35
|
-
lines.detect{|l| l >= @start_line && l <= @end_line}
|
36
|
-
end
|
37
|
-
|
38
34
|
def accept(visitor)
|
39
|
-
visitor.visit_py_string(to_s
|
35
|
+
visitor.visit_py_string(to_s)
|
40
36
|
end
|
41
37
|
|
42
38
|
def arguments_replaced(arguments) #:nodoc:
|
@@ -52,7 +48,6 @@ module Cucumber
|
|
52
48
|
def to_sexp #:nodoc:
|
53
49
|
[:py_string, to_s]
|
54
50
|
end
|
55
|
-
|
56
51
|
end
|
57
52
|
end
|
58
53
|
end
|