Permalink
Browse files

Updates for Cucumber master (0.4.3.pre) tree walking

  • Loading branch information...
1 parent 2a74539 commit d8a08651d91521c78593906f96a2fefbf7f3a697 @brynary committed Oct 20, 2009
@@ -10,32 +10,41 @@ class HttpFormatter
def before_multiline_arg(multiline_arg)
@multiline_arg = true
end
-
+
def after_multiline_arg(multiline_arg)
@multiline_arg = false
end
def before_step(step)
@step_start = Time.now
end
-
- def after_step(step)
- if step.respond_to?(:status)
- progress(Time.now - @step_start, step)
- end
+
+ def after_step_result(keyword, step_match, multiline_arg, status, exception, source_indent, background)
+ progress(Time.now - @step_start, status, step_match, exception)
+ end
+
+ def before_outline_table(outline_table)
+ @outline_table = outline_table
+ end
+
+ def after_outline_table(outline_table)
+ @outline_table = nil
end
def table_cell_value(value, status)
- if (status != :skipped_param) && !@multiline_arg
- progress(0.0, nil, status)
- end
+ return unless @outline_table
+ progress(0.0, status) unless table_header_cell?(status)
end
private
- def progress(time, step_invocation, status = nil)
+ def progress(time, status, step_match = nil, exception = nil)
queue = RedisQueue.new
- queue.push(:results, Result.new(time, step_invocation, status))
+ queue.push(:results, Result.new(time, status, step_match, exception))
+ end
+
+ def table_header_cell?(status)
+ status == :skipped_param
end
end
@@ -9,21 +9,33 @@ def initialize
@backtrace_lines = []
end
- def before_step(step_invocation)
- if step_invocation.respond_to?(:status) #&& step_invocation.status != :outline
- @backtrace_lines << step_invocation.backtrace_line
- end
+ def after_step_result(keyword, step_match, multiline_arg, status, exception, source_indent, background)
+ @backtrace_lines << step_match.backtrace_line
+ end
+
+ def before_outline_table(outline_table)
+ @outline_table = outline_table
+ end
+
+ def after_outline_table(outline_table)
+ @outline_table = nil
end
def table_cell_value(value, status)
- # Testjour.logger.info "#{value.inspect}, #{status.inspect}"
- @backtrace_lines << "Table cell value: #{value}" unless status == :skipped_param
+ return unless @outline_table
+ @backtrace_lines << "Table cell value: #{value}" unless table_header_cell?(status)
end
def count
@backtrace_lines.size
end
+ private
+
+ def table_header_cell?(status)
+ status == :skipped_param
+ end
+
end
end
@@ -18,19 +18,17 @@ class Result
:skipped => 'S'
}
- def initialize(time, step_invocation, status = nil)
- @time = time
-
- if status
- @status = status
- else
- @status = step_invocation.status
- @backtrace_line = step_invocation.backtrace_line
-
- if step_invocation.exception
- @message = step_invocation.exception.message.to_s
- @backtrace = step_invocation.exception.backtrace.join("\n")
- end
+ def initialize(time, status, step_match = nil, exception = nil)
+ @time = time
+ @status = status
+
+ if step_match
+ @backtrace_line = step_match.backtrace_line
+ end
+
+ if exception
+ @message = exception.message.to_s
+ @backtrace = exception.backtrace.join("\n")
end
@pid = $PID

0 comments on commit d8a0865

Please sign in to comment.