diff --git a/Gemfile b/Gemfile index 4a10aac9..2e4afaa1 100644 --- a/Gemfile +++ b/Gemfile @@ -76,6 +76,7 @@ group :development, :test do gem 'capybara' # webkit and poltergeist don't seem to work yet gem 'database_cleaner' + gem 'simplecov', require: false end # Gems left for backwards compatibility diff --git a/Gemfile.lock b/Gemfile.lock index 0c643e7d..2faaccac 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -251,6 +251,10 @@ GEM simple_form (2.1.0) actionpack (~> 3.0) activemodel (~> 3.0) + simplecov (0.7.1) + multi_json (~> 1.0) + simplecov-html (~> 0.7.1) + simplecov-html (0.7.1) sinatra (1.3.6) rack (~> 1.4) rack-protection (~> 1.3) @@ -339,6 +343,7 @@ DEPENDENCIES simple-navigation simple-navigation-bootstrap simple_form + simplecov sqlite3 therubyracer thin diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 69668880..1324abca 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,5 +1,6 @@ # This file is copied to spec/ when you run 'rails generate rspec:install' ENV["RAILS_ENV"] ||= 'test' +require 'support/coverage' # needs to be first require File.expand_path("../../config/environment", __FILE__) require 'rspec/rails' require 'rspec/autorun' diff --git a/spec/support/coverage.rb b/spec/support/coverage.rb new file mode 100644 index 00000000..c67e3172 --- /dev/null +++ b/spec/support/coverage.rb @@ -0,0 +1,14 @@ +# optional test coverage +# needs to be loaded first, e.g. add a require at top of spec_helper +if ENV['COVERAGE'] + require 'simplecov' + SimpleCov.start do + add_filter '/spec/' + add_filter '/test/' + add_group 'Models', '/app/models/' + add_group 'Controllers', '/app/controllers/' + add_group 'Helpers', '/app/helpers/' + add_group 'Documents', '/app/documents/' + add_group 'Libraries', '/lib/' + end +end