通过FactoryBot泄漏到开发来设计用户创建
我正在尝试测试我的应用程序,其中包含一些设计模型(其中一个是用户)
,并且我发现了一种特殊的行为,因为我的应用程序在我正在进行测试时偶然地在后台(开发环境中)运行:
我创建了一个用户:factorybot.create(:user)是由Sidekiq触发的,该ID与测试控制台中创建的记录的ID触发,但试图从开发数据库中选择具有相同用户ID的数据。
(=>我在开发数据库中的地址收到了一封电子邮件,而FactoryBot记录已分配了一个虚拟电子邮件地址)
然后我检查了此线程设计 - 跳过开发中的用户确认,有助于确认手动设计记录(通过填充condect> conjected_at_at
字段)。
但是,我有点担心测试环境中发生的任何事情可能会泄漏到另一个环境中。 我忘了在设计或我的测试环境中配置的东西吗?
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 ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论