Open marcpa00 opened 11 years ago
I don't think that box means that you should change the constructors themselves (as they don't exist), but update any locations where a User
is instantiated with a homepage
value, e.g.
def user = new User(homepage: "http://www.google.com")
Admittedly the language isn't particularly clear. You're also right that the tests need updating once the refactoring is done and that should be made explicit here.
The "Refactoring homepage and breaking tests" on page 76 tells us to update
User()
constructors to changeuser.homepage
withuser.profile.homepage
, but there is no constructor in User class (at that point) and what needs to be done to fix tests is more than just updating the references, as we have to stop trying to assert on homepage as it is now validated withProfile
, notUser
(as per the comments inUserIntegrationSpec
).I think mentionning the effect of extracting
homepage
into another instance, with respect tovalidate()
and thus asserts in spec tests, would be a good addition here.