Class: Cucumber::Ast::Background
- Defined in:
- lib/cucumber/ast/background.rb
Instance Attribute Summary collapse
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#world ⇒ Object
Returns the value of attribute world.
Attributes inherited from Scenario
Instance Method Summary collapse
- #accept(visitor) ⇒ Object
- #already_visited_steps? ⇒ Boolean
-
#initialize(comment, line, keyword, steps) ⇒ Background
constructor
A new instance of Background.
- #step_executed(step) ⇒ Object
-
#to_sexp ⇒ Object
:nodoc:.
Methods inherited from Scenario
#accept_steps, #at_header_or_step_lines?, #at_lines?, #backtrace_line, #file_line, #matches_scenario_names?, #max_line_length, #previous_step, #source_indent, #tagged_with?, #text_length, #undefined?
Constructor Details
#initialize(comment, line, keyword, steps) ⇒ Background
Returns a new instance of Background.
8 9 10 11 |
# File 'lib/cucumber/ast/background.rb', line 8 def initialize(comment, line, keyword, steps) @record_executed_steps = true super(comment, Tags.new(1, []), line, keyword, "", steps) end |
Instance Attribute Details
#status ⇒ Object (readonly)
Returns the value of attribute status.
6 7 8 |
# File 'lib/cucumber/ast/background.rb', line 6 def status @status end |
#world ⇒ Object
Returns the value of attribute world.
5 6 7 |
# File 'lib/cucumber/ast/background.rb', line 5 def world @world end |
Instance Method Details
#accept(visitor) ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/cucumber/ast/background.rb', line 13 def accept(visitor) @world = visitor.new_world if already_visited_steps? @status = execute_steps(visitor) else @status = visit_background_and_steps(visitor, @steps) @steps_visited = true end end |
#already_visited_steps? ⇒ Boolean
27 28 29 |
# File 'lib/cucumber/ast/background.rb', line 27 def already_visited_steps? @steps_visited end |
#step_executed(step) ⇒ Object
23 24 25 |
# File 'lib/cucumber/ast/background.rb', line 23 def step_executed(step) @feature.step_executed(step) if @feature && @record_executed_steps end |
#to_sexp ⇒ Object
:nodoc:
31 32 33 34 35 36 37 38 39 40 |
# File 'lib/cucumber/ast/background.rb', line 31 def to_sexp #:nodoc: sexp = [:background, @line, @keyword] comment = @comment.to_sexp sexp += [comment] if comment = @tags.to_sexp sexp += if .any? steps = @steps.map{|step| step.to_sexp} sexp += steps if steps.any? sexp end |