diff --git a/Gemfile b/Gemfile index 6c27dd1f91..878bddb243 100644 --- a/Gemfile +++ b/Gemfile @@ -25,6 +25,10 @@ group :development, :testing do end end +group :testing do + gem 'rspec-retry' +end + group :development do gem 'ruby-prof', :platforms => :mri gem 'pry-rescue' diff --git a/spec/mongo/client_spec.rb b/spec/mongo/client_spec.rb index 74e3805590..91810523e1 100644 --- a/spec/mongo/client_spec.rb +++ b/spec/mongo/client_spec.rb @@ -1604,8 +1604,8 @@ expect(session).to be_a(Mongo::Session) end - it 'sets the last use field to the current time' do - expect(session.instance_variable_get(:@server_session).last_use).to be_within(2).of(Time.now) + it 'sets the last use field to the current time', retry: 4 do + expect(session.instance_variable_get(:@server_session).last_use).to be_within(1).of(Time.now) end context 'when options are provided' do diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 775d43662b..84f444813d 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -79,6 +79,7 @@ require 'support/authorization' require 'support/primary_socket' require 'support/constraints' +require 'rspec/retry' RSpec.configure do |config| config.include(Authorization)