Does the email address that you set up using Faker in RSpec exist?

Asked 2 years ago, Updated 2 years ago, 113 views

Is the email address that I set using Faker in RSpec real?

I don't have it yet, but when I started creating a feature that would send mail to users,
I think it would be a problem if the email was unintentionally sent to the email address I set using Faker.

For example, if the domain is configuring something that is impossible, I don't think there's much to worry about.Please let me know if you know.
By the way, in my previous work, if I send it to the domain of example.com, the email address does not exist, so
I've been taught to set it up.

ruby-on-rails rspec

2022-09-30 19:21

1 Answers

Depending on the generation method, it can also be used for real emails. example.org and example.net.

https://github.com/stympy/faker/blob/master/doc/internet.md

Faker::Internet.free_email#=>"[email protected]"

Faker::Internet.free_email('Nancy')#=>"[email protected]"

Faker::Internet.safe_email#=>"[email protected]"

Faker::Internet.safe_email('Nancy')#=>"[email protected]"


2022-09-30 19:21

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.