Skip to content

Commit

Permalink
Allow to skip coverage by running SKIP_COV=true bundle exec rake
Browse files Browse the repository at this point in the history
  • Loading branch information
parndt committed Jul 30, 2011
1 parent 1aa5079 commit 1a3a8f7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
5 changes: 4 additions & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ def setup_environment
# This file is copied to ~/spec when you run 'rails generate rspec'
# from the project root directory.
ENV["RAILS_ENV"] ||= 'test'
setup_simplecov if defined?(SimpleCov) # simplecov should be loaded _before_ models, controllers, etc are loaded.

# simplecov should be loaded _before_ models, controllers, etc are loaded.
setup_simplecov unless ENV["SKIP_COV"] || !defined?(SimpleCov)

require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'

Expand Down
14 changes: 7 additions & 7 deletions testing/spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,20 @@ def setup_simplecov
Dir[File.expand_path('../../**/*.gemspec')].map{|g| g.split('/')[-2]}.each do |dir|
add_group dir.capitalize, "#{dir}/"
end
add_filter "/testing/"
add_filter "/config/"
add_filter "/spec/"
add_filter "/vendor/"
%w(testing config spec vendor).each do |filter|
add_filter "/#{filter}/"
end
end
end

def setup_environment
# This file is copied to ~/spec when you run 'rails generate rspec'
# from the project root directory.
ENV["RAILS_ENV"] ||= 'test'
setup_simplecov if defined?(SimpleCov) # simplecov should be loaded _before_ models, controllers, etc are loaded.

# simplecov should be loaded _before_ models, controllers, etc are loaded.
setup_simplecov unless ENV["SKIP_COV"] || !defined?(SimpleCov)

require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'

Expand All @@ -44,8 +46,6 @@ def setup_environment
# config.mock_with :rr
config.mock_with :rspec

config.fixture_path = ::Rails.root.join('spec', 'fixtures').to_s

# If you're not using ActiveRecord, or you'd prefer not to run each of your
# examples within a transaction, comment the following line or assign false
# instead of true.
Expand Down

0 comments on commit 1a3a8f7

Please sign in to comment.