diff --git a/test/support/coverage.rb b/test/support/coverage.rb new file mode 100644 index 000000000..03dbe4a54 --- /dev/null +++ b/test/support/coverage.rb @@ -0,0 +1,22 @@ +return if !ENV['TRAVIS_CI'] + +require 'simplecov' +require 'simplecov-rcov' +require 'coveralls' + +Coveralls.wear! + +class ActiveSupport::TestCase + + # Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order. + # + # Note: You'll currently still have to declare fixtures explicitly in integration tests + # -- they do not yet inherit this setting + SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new([ + SimpleCov::Formatter::RcovFormatter, + Coveralls::SimpleCov::Formatter + ]) + merge_timeout = 3600 + SimpleCov.start + fixtures :all +end diff --git a/test/test_helper.rb b/test/test_helper.rb index 4cd429615..ac3cc749c 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -2,28 +2,14 @@ ENV['RAILS_ENV'] = 'test' require File.expand_path('../config/environment', __dir__) require 'rails/test_help' require 'cache' -require 'simplecov' -require 'simplecov-rcov' -require 'coveralls' -Coveralls.wear! + +require 'test_support_helper' class ActiveSupport::TestCase ActiveRecord::Base.logger = Rails.logger.clone ActiveRecord::Base.logger.level = Logger::INFO - # Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order. - # - # Note: You'll currently still have to declare fixtures explicitly in integration tests - # -- they do not yet inherit this setting - SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new([ - SimpleCov::Formatter::RcovFormatter, - Coveralls::SimpleCov::Formatter - ]) - merge_timeout = 3600 - SimpleCov.start - fixtures :all - # clear cache Cache.clear diff --git a/test/test_support_helper.rb b/test/test_support_helper.rb new file mode 100644 index 000000000..ca83adf9b --- /dev/null +++ b/test/test_support_helper.rb @@ -0,0 +1,2 @@ +# automatically require all helpers in test/support +Dir[Rails.root.join('test', 'support', '**', '*.rb')].each { |f| require f }