context"when a user with empty email already exists"do
beforedo
User.new(
name:"Test McTest",
organisation:create(:organisation),
encrypted_password:SecureRandom.hex(10),
).save!(validate:false)
allow(logger).toreceive(:warn)
end
it"does not create a data sharing confirmation because it thinks it exists already and logs a misleading message"do
expect(logger).toreceive(:warn).with("Data protection confirmation 7c5bd5fb549c09a2c55d7cb90d7ba84927e64618 created by John Doe for DLUHC is already present, skipping.")