Skip to content

Commit

Permalink
Freeze test data for docs
Browse files Browse the repository at this point in the history
  • Loading branch information
guillermoap committed Sep 28, 2023
1 parent a4f3bb3 commit 3c98d06
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions spec/rails_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
config.include Devise::Test::ControllerHelpers, type: :controller
config.include Devise::Test::IntegrationHelpers, type: :request
config.include ActiveJob::TestHelper
config.include ActiveSupport::Testing::TimeHelpers
config.use_transactional_fixtures = true
config.infer_spec_type_from_file_location!

Expand All @@ -46,6 +47,17 @@

# Reset previous flipper instance
config.before { Flipper.instance = nil }

# Freeze data to not change OPENAPI docs
if ENV['OPENAPI']
ActiveRecord::Base.connection.tables.each do |t|
ActiveRecord::Base.connection.reset_pk_sequence!(t)
end
Kernel.srand config.seed
config.before(:all) { Faker::Config.random = Random.new(config.seed) }
config.before { travel_to Time.local(2023) }
config.after { travel_back }
end
end

Shoulda::Matchers.configure do |config|
Expand Down

0 comments on commit 3c98d06

Please sign in to comment.