Skip to content
This repository has been archived by the owner on Dec 19, 2020. It is now read-only.

An example of how to setup PigCi for use within a Rails app

Notifications You must be signed in to change notification settings

PigCI/Sample-Rails-PigCI-Setup-App

Repository files navigation

Build Status CircleCI

Sample Rails PigCI Setup

Sample Output of PigCI in TravisCI

This is a sample app for demonstrating how to setup the pig-ci-rails gem in your Ruby on Rails application, so you can monitor key metrics of your test suite.

Once setup, PigCI will monitor your app during when you run the test suite. Once the tests are complete it will output the key stats to terminal & to the /pig-ci folder.

Getting Setup

With RailsBytes

In terminal, run:

$ rails app:template LOCATION='https://railsbytes.com/script/Vdrswr'

Add the gem

Add the gem to your Gemfile:

group :test do
  gem 'pig-ci-rails'
end

Update Gitignore

Ignore the pig-ci folder, which is where metrics are saved for review after tests are ran by updating .gitignore with:

# PigCI
/pig-ci

Setup for RSpec

Update spec/rails_helper.rb with the following:

require 'pig_ci'
PigCI.start do |config|
  # Setup your thresholds if you don't like the defaults
  # Maximum memory in megabytes
  config.thresholds.memory = 300

  # Maximum time per a HTTP request
  config.thresholds.request_time = 200

  # Maximum database calls per a request
  config.thresholds.database_request = 15
end if RSpec.configuration.files_to_run.count > 1