]> git.openstreetmap.org Git - rails.git/commitdiff
Allow FactoryBot to set primary key attributes
authorTom Hughes <tom@compton.nu>
Tue, 28 Nov 2023 18:25:35 +0000 (18:25 +0000)
committerTom Hughes <tom@compton.nu>
Tue, 28 Nov 2023 18:25:35 +0000 (18:25 +0000)
We have at least model (Language) which does not use datbase
generated primary keys so we need to be able to set them.

https://github.com/thoughtbot/factory_bot_rails/pull/419

config/environments/test.rb

index 08d3236bfd21dc6a328d8acdbf9320f1053b7273..80871151fa501761b7a6e6e938a5fc38f3f88653 100644 (file)
@@ -67,4 +67,7 @@ Rails.application.configure do
 
   # Use the test adapter for ActiveJob during testing.
   config.active_job.queue_adapter = :test
+
+  # Allow FactoryBot to set primary key attributes
+  config.factory_bot.reject_primary_key_attributes = false
 end