Skip to content

Instantly share code, notes, and snippets.

@nuc
Forked from natritmeyer/progress_with_names.rb
Created November 16, 2011 17:39
Show Gist options
  • Save nuc/1370772 to your computer and use it in GitHub Desktop.
Save nuc/1370772 to your computer and use it in GitHub Desktop.
An rspec formatter that prints each test name and result to the console on a new line - hudson likes it
require "rspec/core/formatters/base_text_formatter"
class ProgressWithNames < RSpec::Core::Formatters::BaseTextFormatter
def example_passed(example)
super(example)
output.print green(".")
end
def example_pending(example)
super(example)
output.print yellow(".")
end
def example_failed(example)
super(example)
output.print red("\n#{example.full_description}\n")
output.print red(" #{example.example_group.metadata[:example_group][:file_path].gsub(/.*?\/spec\//, '') + ":" + example.example_group.metadata[:example_group][:line_number].to_s}\n")
end
def start_dump
super()
output.puts
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment