Skip to content

Instantly share code, notes, and snippets.

@nathan-appere
Created February 6, 2022 10:41
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nathan-appere/4d9013631999e030738133d3084dfbe4 to your computer and use it in GitHub Desktop.
Save nathan-appere/4d9013631999e030738133d3084dfbe4 to your computer and use it in GitHub Desktop.
RSpec helper for deterministic specs
require 'factory_bot_rails'
RSpec.configure do |config|
config.before do
Random.srand(config.seed)
Faker::Config.random = Random.new(config.seed)
allow(SecureRandom).to(receive(:uuid).and_wrap_original { |*| Faker::Internet.uuid })
end
config.after do
FactoryBot.rewind_sequences
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment