Last active
August 29, 2015 13:56
-
-
Save orend/9099893 to your computer and use it in GitHub Desktop.
Time travel and dependencies
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def age(with_respect_to = Time.now) | |
... | |
end |
@fxn - to answer your question: I would test that the age of the user is shown in his profile page but not by asserting the exact age. I think this will be over-testing. In the collaborators' unit test you'd have set expectations that the age
method is being called, and in age
's unit test you'd test it does the right thing - performing the correct calculation with respect to the given parameter. In the integration test I'd maybe test that the displayed age is numeric and between 0 and 150. No need to test ``age`'s logic again. The default code for the parameter will get executed and if it was a typo or something that doesn't make sense it would get caught in the integration test.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
continuing the discussion from rails/rails#12824 (comment)