SimpleCov

Code coverage for Ruby 1.9+ with a powerful configuration library and automatic merging of coverage across test suites
Icons/chart bar
Used 121 times
Created by
C Chris Oliver

Usage

Run this command in your Rails app directory in the terminal:

rails app:template LOCATION="https://railsbytes.com/script/zPdsaZ"
Template Source

Review the code before running this template on your machine.

gem 'simplecov', require: false, group: :test

Bundler.with_unbundled_env { run 'bundle install' }

files = [
  'test/test_helper.rb', 
  'spec/spec_helper.rb'
]
files.each do |filename|
  if File.exist?(filename)
    prepend_to_file filename, <<~TEMPLATE
      require 'simplecov'
      SimpleCov.start

      TEMPLATE
  end
end

rails_command("test") if yes?("Would you like to run your test suite and generate coverage reports?")
Comments

Sign up or Login to leave a comment.