Skip to content

Commit

Permalink
fix ZeroDivisionError when no test ran.
Browse files Browse the repository at this point in the history
  • Loading branch information
moro committed Apr 13, 2012
1 parent 361cd64 commit 1708e15
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/rspec/core/formatters/base_text_formatter.rb
Expand Up @@ -54,7 +54,7 @@ def dump_commands_to_rerun_failed_examples
def dump_profile
sorted_examples = examples.sort_by { |example| example.execution_result[:run_time] }.reverse.first(10)

total, slows = [examples, sorted_examples].map {|exs| exs.inject(0) {|i, e| i + e.execution_result[:run_time] } }
total, slows = [examples, sorted_examples].map {|exs| exs.inject(0.0) {|i, e| i + e.execution_result[:run_time] } }
output.puts "\nTop #{sorted_examples.size} slowest examples (#{format_seconds(slows)} seconds, occupied #{((slows / total) * 100).round(2)}% time):\n"

sorted_examples.each do |example|
Expand Down

0 comments on commit 1708e15

Please sign in to comment.