Skip to content

Commit 94c145b

Browse files
committed
feat: use rspec retry to deflake ci
This is a bandaid fix that does not address the root cause.
1 parent 9ce607c commit 94c145b

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ end
9898
group :test do
9999
gem "brakeman" # security inspection
100100
gem "capybara"
101+
gem "rspec-retry" # for retrying flaky tests
101102
gem "capybara-screenshot"
102103
gem "database_cleaner-active_record"
103104
gem "docx"

Gemfile.lock

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,8 @@ GEM
472472
rspec-expectations (~> 3.13)
473473
rspec-mocks (~> 3.13)
474474
rspec-support (~> 3.13)
475+
rspec-retry (0.6.2)
476+
rspec-core (> 3.3)
475477
rspec-support (3.13.2)
476478
rspec_junit_formatter (0.6.0)
477479
rspec-core (>= 2, < 4, != 2.12.0)
@@ -695,6 +697,7 @@ DEPENDENCIES
695697
request_store
696698
rexml
697699
rspec-rails
700+
rspec-retry
698701
rspec_junit_formatter
699702
rswag-api
700703
rswag-specs

spec/support/rspec_retry.rb

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# spec/spec_helper.rb
2+
require 'rspec/retry'
3+
4+
RSpec.configure do |config|
5+
# show retry status in spec process
6+
config.verbose_retry = true
7+
# show exception that triggers a retry if verbose_retry is set to true
8+
config.display_try_failure_messages = true
9+
10+
if ENV['CI'] == 'true'
11+
# run retry only on features
12+
config.around :each, :js do |ex|
13+
ex.run_with_retry retry: 3
14+
end
15+
end
16+
end

0 commit comments

Comments
 (0)