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.
I didn't know that: thanks for the tip :)
'and' should not be used in logical comparisions, it should be used only in flow logic, for example in ruby on rails controllers you often see something like:
yes, using 'and' often gives valid results but it's bad practice because the 'and' operation has lower precedence than '&&' and you asking for strange bugs in code
also, this method returns a boolean and so it should end with a "?" like "is_santa_clausable?"
Yeah, I had that implemented but my sort code was returning a new array and that is the array I was pulling the gift from. Thanks for pointing me in the right direction.
I cannot seem to get past the fourth test on this kata. I get the following error:
Test Failed: Incorrect queue length - Expected: 1, instead got: 2
I have these tests currently passing before trying to submit:
giftList = HolidayPriorityQueue.new
length = 0
Test.assert_equals(giftList.buyGift(), '')
length = giftList.addGift( { 'gift' => 'Water gun', 'priority' => 1 } )
Test.assert_equals(length, 1, 'Incorrect queue length')
length = giftList.addGift( { 'gift' => 'BB gun', 'priority' => 2 } )
Test.assert_equals(length, 2)
Test.assert_equals(giftList.buyGift(), 'Water gun')
I have re-read the instructions several times and it appears that these tests cover all the requirements. I thought maybe this was a test for invalid hashes so I added some code to verify the existence of the "gift" and "priority" keys but still got the failure above.
Since I cannot see the creator's tests without giving up the points I could earn, I was hoping someone could point me in the right direction.
Thanks!