Class: Cucumber::Ast::Scenario
Instance Method Summary
collapse
#attach_steps, #backtrace_line, #file_colon_line, #has_tags?, #matches_lines?, #matches_scenario_names?, #max_line_length, #previous_step, #source_indent, #text_length
Constructor Details
#initialize(background, comment, tags, line, keyword, name, steps) ⇒ Scenario
Returns a new instance of Scenario.
8
9
10
11
12
13
14
15
16
17
18
|
# File 'lib/cucumber/ast/scenario.rb', line 8
def initialize(background, , tags, line, keyword, name, steps)
@background, @comment, @tags, @line, @keyword, @name = background, , tags, line, keyword, name
attach_steps(steps)
step_invocations = steps.map{|step| step.step_invocation}
if @background
@steps = @background.step_collection(step_invocations)
else
@steps = StepCollection.new(step_invocations)
end
end
|
Instance Method Details
#accept(visitor) ⇒ Object
32
33
34
35
36
37
38
39
40
41
42
|
# File 'lib/cucumber/ast/scenario.rb', line 32
def accept(visitor)
visitor.(@comment)
visitor.visit_tags(@tags)
visitor.visit_scenario_name(@keyword, @name, file_colon_line(@line), source_indent(text_length))
skip = @background && @background.failed?
skip_invoke! if skip
visitor.step_mother.before_and_after(self, skip) do
visitor.visit_steps(@steps)
end
end
|
#descend?(visitor) ⇒ Boolean
25
26
27
28
29
30
|
# File 'lib/cucumber/ast/scenario.rb', line 25
def descend?(visitor)
visitor.matches_lines?(self) &&
visitor.included_by_tags?(self) &&
!visitor.excluded_by_tags?(self) &&
visitor.matches_scenario_names?(self)
end
|
#feature=(feature) ⇒ Object
20
21
22
23
|
# File 'lib/cucumber/ast/scenario.rb', line 20
def feature=(feature)
@feature = feature
@background.feature = feature if @background
end
|
#skip_invoke! ⇒ Object
44
45
46
47
48
49
|
# File 'lib/cucumber/ast/scenario.rb', line 44
def skip_invoke!
@steps.each{|step_invocation| step_invocation.skip_invoke!}
@feature.next_feature_element(self) do |next_one|
next_one.skip_invoke!
end
end
|
51
52
53
54
55
56
57
58
59
60
|
# File 'lib/cucumber/ast/scenario.rb', line 51
def to_sexp
sexp = [:scenario, @line, @keyword, @name]
= @comment.to_sexp
sexp += [] if
tags = @tags.to_sexp
sexp += tags if tags.any?
steps = @steps.to_sexp
sexp += steps if steps.any?
sexp
end
|