Moved coverage logic into support folder to increase clarity and only include on TravisCI runs to reduce test runtime.
This commit is contained in:
parent
11e63fe21a
commit
ba9845cb68
3 changed files with 26 additions and 16 deletions
22
test/support/coverage.rb
Normal file
22
test/support/coverage.rb
Normal file
|
@ -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
|
|
@ -2,28 +2,14 @@ ENV['RAILS_ENV'] = 'test'
|
||||||
require File.expand_path('../config/environment', __dir__)
|
require File.expand_path('../config/environment', __dir__)
|
||||||
require 'rails/test_help'
|
require 'rails/test_help'
|
||||||
require 'cache'
|
require 'cache'
|
||||||
require 'simplecov'
|
|
||||||
require 'simplecov-rcov'
|
require 'test_support_helper'
|
||||||
require 'coveralls'
|
|
||||||
Coveralls.wear!
|
|
||||||
|
|
||||||
class ActiveSupport::TestCase
|
class ActiveSupport::TestCase
|
||||||
|
|
||||||
ActiveRecord::Base.logger = Rails.logger.clone
|
ActiveRecord::Base.logger = Rails.logger.clone
|
||||||
ActiveRecord::Base.logger.level = Logger::INFO
|
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
|
# clear cache
|
||||||
Cache.clear
|
Cache.clear
|
||||||
|
|
||||||
|
|
2
test/test_support_helper.rb
Normal file
2
test/test_support_helper.rb
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
# automatically require all helpers in test/support
|
||||||
|
Dir[Rails.root.join('test', 'support', '**', '*.rb')].each { |f| require f }
|
Loading…
Reference in a new issue