Code coverage for my ruby code
Used 15 times
S
Sakshi
Usage
Run this command in your Rails app directory in the terminal:
rails app:template LOCATION="https://railsbytes.com/script/z0gsp4"
Template Source
Review the code before running this template on your machine.
gem 'simplecov', require: false, group: :test
run 'bundle install'
files = [
'spec/spec_helper.rb',
'test/test_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 coverage reports?")