From 5ef26d8fd50081c642b858a82bf0c5431b1c7e83 Mon Sep 17 00:00:00 2001 From: Nick Schonning Date: Tue, 17 Oct 2023 12:28:09 -0400 Subject: [PATCH] Add RSpec GitHub annotations gem (#24040) --- Gemfile | 3 +++ Gemfile.lock | 3 +++ spec/spec_helper.rb | 6 ++++++ 3 files changed, 12 insertions(+) diff --git a/Gemfile b/Gemfile index 17cbabd3b..98897536a 100644 --- a/Gemfile +++ b/Gemfile @@ -106,6 +106,9 @@ group :test do # Used to split testing into chunks in CI gem 'rspec_chunked', '~> 0.6' + # Adds RSpec Error/Warning annotations to GitHub PRs on the Files tab + gem 'rspec-github', '~> 2.4', require: false + # RSpec progress bar formatter gem 'fuubar', '~> 2.5' diff --git a/Gemfile.lock b/Gemfile.lock index c3d1ca209..29cdc8aa4 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -602,6 +602,8 @@ GEM rspec-expectations (3.12.3) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.12.0) + rspec-github (2.4.0) + rspec-core (~> 3.0) rspec-mocks (3.12.5) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.12.0) @@ -885,6 +887,7 @@ DEPENDENCIES redis (~> 4.5) redis-namespace (~> 1.10) rqrcode (~> 2.2) + rspec-github (~> 2.4) rspec-rails (~> 6.0) rspec-sidekiq (~> 4.0) rspec_chunked (~> 0.6) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index b4c20545f..4d3c234a0 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -36,6 +36,12 @@ RSpec.configure do |config| config.after :suite do FileUtils.rm_rf(Dir[Rails.root.join('spec', 'test_files')]) end + + # Use the GitHub Annotations formatter for CI + if ENV['GITHUB_ACTIONS'] == 'true' + require 'rspec/github' + config.add_formatter RSpec::Github::Formatter + end end def body_as_json