class Cucumber::Ast::Scenario
:nodoc:
def accept(visitor)
def accept(visitor) return if Cucumber.wants_to_quit with_visitor(visitor) do visitor.visit_comment(@comment) unless @comment.empty? visitor.visit_tags(@tags) visitor.visit_scenario_name(@keyword, @name, file_colon_line(@line), source_indent(first_line_length)) skip_invoke! if @background.failed? visitor.step_mother.with_hooks(self, skip_hooks?) do skip_invoke! if failed? visitor.visit_steps(@steps) end @executed = true end end
def exception
def exception @exception || @steps.exception end
def fail!(exception)
def fail!(exception) @exception = exception @current_visitor.visit_exception(@exception, :failed) end
def failed?
def failed? @steps.failed? || !!@exception end
def init
def init return if @steps @background.init @background.feature_elements << self attach_steps(@raw_steps) step_invocations = @raw_steps.map{|step| step.step_invocation} @steps = @background.step_collection(step_invocations) end
def initialize(background, comment, tags, line, keyword, name, raw_steps)
def initialize(background, comment, tags, line, keyword, name, raw_steps) @background = background || EmptyBackground.new @comment, @tags, @line, @keyword, @name, @raw_steps = comment, tags, line, keyword, name, raw_steps @exception = @executed = nil end
def passed?
def passed? !failed? end
def skip_hooks?
def skip_hooks? @background.failed? || @executed end
def skip_invoke!
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
def status
def status return :failed if @exception @steps.status end
def to_sexp
def to_sexp sexp = [:scenario, @line, @keyword, @name] comment = @comment.to_sexp sexp += [comment] if comment tags = @tags.to_sexp sexp += tags if tags.any? steps = @steps.to_sexp sexp += steps if steps.any? sexp end
def with_visitor(visitor)
def with_visitor(visitor) @current_visitor = visitor yield @current_visitor = nil end