Skip to content

Instantly share code, notes, and snippets.

@kmckelvin
Created March 18, 2012 09:55
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kmckelvin/2070250 to your computer and use it in GitHub Desktop.
Save kmckelvin/2070250 to your computer and use it in GitHub Desktop.
RSpec formatter with timed outputs
require 'rspec/core/formatters/documentation_formatter'
class TimedFormatter < RSpec::Core::Formatters::DocumentationFormatter
def example_passed(example)
output.puts "#{passed_output(example)} - #{example.execution_result[:run_time]}"
end
def example_failed(example)
output.puts "#{failure_output(example, example.execution_result[:exception])} - #{example.execution_result[:run_time]}"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment