Reload otp_devices to get default

This appears to be more agressively cached by rails 7 now
pull/10698/head
Oliver Günther 2 years ago
parent f83d4f0b47
commit 797bc9f08e
No known key found for this signature in database
GPG Key ID: 88872239EB414F99
  1. 2
      modules/two_factor_authentication/app/models/two_factor_authentication/device.rb
  2. 2
      modules/two_factor_authentication/spec/models/devices/default_device_spec.rb

@ -66,7 +66,7 @@ module TwoFactorAuthentication
Device.transaction do
Device.where(user_id: user_id).update_all(default: false)
update_column(:default, true)
return true
true
end
end

@ -28,7 +28,7 @@ describe 'Default device', with_2fa_ee: true, type: :model do
expect(user.otp_devices.get_default).to eq(other_otp)
subject.make_default!
expect(user.otp_devices.get_default).to eq(subject)
expect(user.otp_devices.reload.get_default).to eq(subject)
end
end
end

Loading…
Cancel
Save