From: Josh Thompson Date: Wed, 17 Apr 2024 19:52:39 +0000 (-0600) Subject: unburden call for User fabrication X-Git-Tag: live~687^2~1 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/4cac6b035410619a4b6bece8be6f224fb06b3c87 unburden call for User fabrication Speeds up tests rather nicely, derived via trial and error reasonably confident that this is nice. overheard it mentioned by Vladimir Dementyev in a Codewithjason podcast, so when my intuition already led me to the user factory, I figured 'on principle/correctness, I should at least look at what happens if we sidestep the native hashing library, because it's something i was already curious about. --- diff --git a/test/factories/user.rb b/test/factories/user.rb index 5b92345c2..7823c0e9f 100644 --- a/test/factories/user.rb +++ b/test/factories/user.rb @@ -2,7 +2,7 @@ FactoryBot.define do factory :user do sequence(:email) { |n| "user#{n}@example.com" } sequence(:display_name) { |n| "User #{n}" } - pass_crypt { PasswordHash.create("test").first } + pass_crypt { "$argon2id$v=19$m=65536,t=3,p=4$M+oP6KQOdFLDeiYa/gbzAg$pULNwXgKt2sEmTxMXxt298skEqc8MjnPwGsk075jLrk" } # These attributes are not the defaults, but in most tests we want # a 'normal' user who can log in without being redirected etc.