lib/lucid/ast/background.rb in lucid-0.0.6 vs lib/lucid/ast/background.rb in lucid-0.0.7

- old
+ new

@@ -7,10 +7,11 @@ class Background #:nodoc: include HasSteps include Names include HasLocation attr_accessor :feature + attr_accessor :comment def initialize(language, location, comment, keyword, title, description, raw_steps) @language, @location, @comment, @keyword, @title, @description, @raw_steps = language, location, comment, keyword, title, description, raw_steps @failed = nil @first_collection_created = false @@ -34,17 +35,19 @@ end end def accept(visitor) return if Lucid.wants_to_quit - visitor.visit_comment(@comment) unless @comment.empty? - visitor.visit_background_name(@keyword, name, file_colon_line, source_indent(first_line_length)) - with_visitor(hook_context, visitor) do - visitor.runtime.before(hook_context) - skip_invoke! if failed? - visitor.visit_steps(step_invocations) - @failed = step_invocations.any? { |step_invocation| step_invocation.exception || step_invocation.status != :passed } - visitor.runtime.after(hook_context) if @failed || feature_elements.empty? + visitor.visit_background(self) do + comment.accept(visitor) + visitor.visit_background_name(@keyword, name, file_colon_line, source_indent(first_line_length)) + with_visitor(hook_context, visitor) do + visitor.runtime.before(hook_context) + skip_invoke! if failed? + step_invocations.accept(visitor) + @failed = step_invocations.any? { |step_invocation| step_invocation.exception || step_invocation.status != :passed } + visitor.runtime.after(hook_context) if @failed || feature_elements.empty? + end end end def with_visitor(scenario, visitor) @current_visitor = visitor