Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
This comment is hidden because it contains spoiler information about the solution
Thanks for the quick update! However, your
reset_complete!
now does the same thing ascomplete!
;) It doesn't set@complete
tonil
.Changing
entered
toenter
andresponded
torespond
should do the trick ;)Interesting kata. However, I found the description being confusing. You specify "the block passed in to
attr_lazy
should only be called, and its value applied to the variable, if the variable is nil." Yet your test cases specify that blocks should not reevaluate even if the block returns nil. What's probably meant and what most people understood is "... if the variable is not defined".I also noticed a small mistake in the test case
should not call the block if the variable is set manually
. You set@complete
manually usingcomplete!
but you don't callcheck
orcomplete?
afterwards. Therefor the case doesn't test anyAttrLazy
effects at all.complete_checked_at
is alwaysnil
.Also I suggest adding this test case:
My first solution actually allowed evaluation of the block if the variable was manually defined and set to
nil
before. All current tests pass but it's probably not the expected behaviour. The suggested test covers this scenario.It's a mistake in the random test data. Check the
verbs
array in the ruby translation tests cases:verbs.grep(/ed$/) =>["entered", "responded"]
. It should only contain verbs not already ending ined
.There are random test failures when input starts with
Today I didn't entered
orToday I didn't responded
(which looks incorrect anyway). Example test:It should work for random inputs too - Expected: "I don't think you didn't entered the fireman today, I think you did entered it!"