Open eldondevcg opened 7 years ago
"populate" does not take any parameters as given and it seems using user input is also not right because if done so, the test never ends.
If I could change the design slightly so "populate" has a parameter or takes an user input to be typed in console for domain, I think I am done with the issue.
Could you give me idea about how it knows which domain to use?
On console, I am doing the following:
>> domain = Domain.new >> domain.populate("google.com") >> domain.save
or
>> domain = Domain.new >> domain.populate google.com >> domain.save
Populate is an instance method and was intentionally created without any parameters. Can you think of another way to set the name
attribute on an instance of Domain without having populate
take an input?
If there's nowhere to fetch domain, then the only way I can think of is to pass domain(e.g. "google.com") as name
when creating an instance of domain
and using the name to generate whois
in populate
.
So,
>> domain = Domain.new(:name => "google.com") >> domain.populate >> domain.save
This way, it passes the test.
For each domain on the internet, it is possible to request WHOIS information from the registrar. As a system user at the rails console, I should be able to call "populate" on a domain. Afterwards, the response field in the domain should then contain the whois data for that domain. If I subsequently call
domain.save
, that whois data should be persisted to the database.