X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/ddd5b4cf19a92582fd114914be5bd5a04d3522a7..3f607d565bc0e2c7b1b738301c11c16d069913d5:/vendor/gems/rspec-1.1.2/lib/spec/runner/formatter/html_formatter.rb diff --git a/vendor/gems/rspec-1.1.2/lib/spec/runner/formatter/html_formatter.rb b/vendor/gems/rspec-1.1.2/lib/spec/runner/formatter/html_formatter.rb new file mode 100644 index 000000000..ad153c8dc --- /dev/null +++ b/vendor/gems/rspec-1.1.2/lib/spec/runner/formatter/html_formatter.rb @@ -0,0 +1,333 @@ +require 'erb' +require 'spec/runner/formatter/base_text_formatter' + +module Spec + module Runner + module Formatter + class HtmlFormatter < BaseTextFormatter + include ERB::Util # for the #h method + + def initialize(options, output) + super + @current_example_group_number = 0 + @current_example_number = 0 + end + + # The number of the currently running example_group + def current_example_group_number + @current_example_group_number + end + + # The number of the currently running example (a global counter) + def current_example_number + @current_example_number + end + + def start(example_count) + @example_count = example_count + + @output.puts html_header + @output.puts report_header + @output.flush + end + + def add_example_group(example_group) + super + @example_group_red = false + @example_group_red = false + @current_example_group_number += 1 + unless current_example_group_number == 1 + @output.puts " " + @output.puts "" + end + @output.puts "
#{format_backtrace(failure.exception.backtrace)}
#{@snippet_extractor.snippet(failure.exception)}
"
+ end
+
+ def move_progress
+ @output.puts " "
+ @output.flush
+ end
+
+ def percent_done
+ result = 100.0
+ if @example_count != 0
+ result = ((current_example_number).to_f / @example_count.to_f * 1000).to_i / 10.0
+ end
+ result
+ end
+
+ def dump_failure(counter, failure)
+ end
+
+ def dump_summary(duration, example_count, failure_count, pending_count)
+ if dry_run?
+ totals = "This was a dry-run"
+ else
+ totals = "#{example_count} example#{'s' unless example_count == 1}, #{failure_count} failure#{'s' unless failure_count == 1}"
+ totals << ", #{pending_count} pending" if pending_count > 0
+ end
+ @output.puts ""
+ @output.puts ""
+ @output.puts ""
+ @output.puts ""
+ @output.puts "