View as Markdown

RSpec Integration with CI Insights

Report your test results from RSpec to CI Insights


This guide explains how to integrate RSpec with CI Insights using the rspec-mergify gem. Once installed, test results are automatically uploaded to CI Insights without any extra workflow changes.

You need to install the rspec-mergify gem to automatically upload your test results to CI Insights.

Add the gem to your Gemfile:

group :test do
gem 'rspec-mergify'
end

Then run:

Terminal window
bundle install

Alternatively, install it directly:

Terminal window
gem install rspec-mergify

Your workflow should run your tests as usual while exporting the secret MERGIFY_TOKEN as an environment variable.

Add the following to the GitHub Actions step running your tests:

env:
MERGIFY_TOKEN: ${{ secrets.MERGIFY_TOKEN }}

For example:

- name: Run RSpec Tests 🧪
env:
MERGIFY_TOKEN: ${{ secrets.MERGIFY_TOKEN }}
run: bundle exec rspec

Set MERGIFY_TOKEN as an environment variable in your pipeline step:

steps:
- label: "Run RSpec Tests 🧪"
command: bundle exec rspec
env:
MERGIFY_TOKEN: "${MERGIFY_TOKEN}"

The gem automatically collects your test results and sends them to CI Insights.

Check the CI Insights dashboard afterward to view execution metrics, detect flaky tests, and review test trends.

VariablePurposeDefault
MERGIFY_TOKENAPI authentication tokenRequired
MERGIFY_API_URLAPI endpoint locationhttps://api.mergify.com
RSPEC_MERGIFY_ENABLEForce-enable outside CIfalse
RSPEC_MERGIFY_DEBUGPrint spans to consolefalse
MERGIFY_TRACEPARENTW3C distributed trace contextOptional
MERGIFY_TEST_JOB_NAMETest job name identifierOptional

Was this page helpful?