Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exclude seeds from coveralls scan #1211

Merged
merged 1 commit into from Mar 7, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 20 additions & 0 deletions spec/rails_helper.rb
Expand Up @@ -2,6 +2,26 @@
# This file is copied to spec/ when you run 'rails generate rspec:install'
ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../../config/environment', __FILE__)

def coverage_needed?
(!ENV['RAILS_VERSION'] || ENV['RAILS_VERSION'].start_with?('5.0')) &&
(ENV['COVERAGE'] || ENV['TRAVIS'])
end

if coverage_needed?
require 'simplecov'
require 'coveralls'
SimpleCov.root(File.expand_path('../..', __FILE__))
SimpleCov.formatter = Coveralls::SimpleCov::Formatter
SimpleCov.start('rails') do
add_filter '/spec'
add_filter '/tasks'
add_filter '/lib/seed_methods.rb'
add_filter '/db/seeds.rb'
end
SimpleCov.command_name 'spec'
end

# Prevent database truncation if the environment is production
abort("The Rails environment is running in production mode!") if Rails.env.production?
require 'spec_helper'
Expand Down