pig-ci-rails
Monitor your Ruby Applications metrics (Memory, SQL Requests & Request Time) as part of your test suite.
Used 21 times
M
Mike Rogers
Usage
This installs pig-ci-rails - It's an RSpec addon that'll set thresholds for metrics such as memory usage & database requests.
Run this command in your Rails app directory in the terminal:
rails app:template LOCATION="https://railsbytes.com/script/Vdrswr"
Template Source
Review the code before running this template on your machine.
gem_group :test do
gem 'pig-ci-rails'
end
run 'bundle'
inject_into_file 'spec/rails_helper.rb' do
<<~EOF
require 'pig_ci'
if RSpec.configuration.files_to_run.count > 1
PigCI.start do |config|
# Maximum memory in megabytes
config.thresholds.memory = 350
# Maximum time per a HTTP request
config.thresholds.request_time = 250
# Maximum database calls per a request
config.thresholds.database_request = 35
end
end
EOF
end
inject_into_file '.gitignore' do
<<~EOF
# PigCI
/pig-ci
EOF
end