1 year ago

#364670

test-img

Maxence

Devise user creation through FactoryBot leaking to development

I am trying to test my app which contains some Devise models (one of them being User)

And I have found a peculiar behavior as my app was by chance running in the background (in development environment) at the time I was working on the tests:

I created a user :FactoryBot.create(:user) in a test console (rails c -e test) and saw in my dev console that a Devise confirmation email had been triggered by Sidekiq with the id of the record created in the test console, but trying to pick data with same User ID from the Development database.

(=> I received an email at the address in the development database, while the FactoryBot record had been assigned a dummy email address)

I have then checked this thread Devise - Skipping user confirmation in Development that helps confirm Devise records manually (by populating confirmed_at field).

Yet I am a bit concerned of anything happening in test environment could be leaking to another environment. Is there something I forgot to configure in Devise or my Test environment ?

ruby-on-rails

devise

factory-bot

sidekiq

0 Answers

Your Answer

Accepted video resources