Created
August 19, 2015 04:27
-
-
Save davidoram/b938e800271f31119e44 to your computer and use it in GitHub Desktop.
Rspec 2 formatter to output files in the order they are tested
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Rspec 2.x custom formatter that will run all your tests and output a list of spec files that have been run | |
# | |
# Can be usefull for extracting all of the files that nmake up the test run | |
# | |
# TZ=Pacific/Auckland bundle exec rspec spec --tag ~integration --tag ~fragile --require ./custom_formatter.rb --format CustomFormatter --out specs.txt --seed 34104 | |
# | |
require "rspec/core/formatters/base_text_formatter" | |
require 'JSON' | |
class CustomFormatter < RSpec::Core::Formatters::BaseTextFormatter | |
def initialize(output) | |
super(output) | |
@files = [] | |
end | |
def example_started(proxy) | |
@files << proxy.file_path unless @files.include? proxy.file_path | |
end | |
def dump_summary(duration, example_count, failure_count, pending_count) | |
@files.each do |f| | |
output << f | |
output << "\n" | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment