Created
February 6, 2022 10:41
-
-
Save nathan-appere/4d9013631999e030738133d3084dfbe4 to your computer and use it in GitHub Desktop.
RSpec helper for deterministic specs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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