Created
April 16, 2012 20:50
-
-
Save rcorreia/2401427 to your computer and use it in GitHub Desktop.
Using ci_reporter with parallel_tests
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
# The way the parallel_tests gem loads the test suite is incompatible with how ci_reporter loads the | |
# test suite. This module reconciles the difference by recognizing when ci_reporter is expected to | |
# be loaded and then doing it. | |
module ParallelCIReporter | |
# Sets up ci_reporter if necessary. | |
def self.setup_ci_reporter | |
install_mediator if ci_reporter? | |
end | |
# Adds CI::Reporter::TestUnit as a test mediator for Test::Unit. | |
def self.install_mediator | |
require 'ci/reporter/rake/test_unit_loader' | |
end | |
private_class_method :install_mediator | |
# Tests whether 'ci_reporter' is supposed to be setup. This detects a modification made to the | |
# TESTOPTS environment variable that is made in the ci:setup:testunit Rake task. | |
def self.ci_reporter? | |
ENV["TESTOPTS"] =~ /ci_reporter/ | |
end | |
private_class_method :ci_reporter? | |
end | |
ParallelCIReporter.setup_ci_reporter |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment