Monday, September 22, 2008

Rails with NO Fixtures?

I have a Rails project, and I created a Country model. I added the basic details of Norway to the countries.yml fixture.
norway:
 code: NO
 name: Norway
I added a unit test to make sure I could get Norway by it's country code, which is NO
def test_find_by_code
 assert_equal countries(:norway), Country.find_by_code('NO')
end
Agreed, I probably don't need a unit test for this, but this should have worked, but it was failing with the following message.
Country id: 318845244, code: "1", name: "Norway" expected but was
nil
Apparently NO in the yaml file is interpreted as a 0 (zero). To prove the theory I changed the code of norway to YES. The unit test failed, and indicated that the model it expected should have had code: "1". Changing countries.yml to be...
norway:
 code: "NO"
 name: Norway
I personally really like fixtures and the nice features they bring in, but sometimes they can catch you out. I'm sure it's not a bug, I've just never encountered this before. Ever found anything strange in your fixtures?

Tuesday, September 16, 2008

Phantom Butterlies OSX Screensaver

I've had the Phantom Butterflies screensaver installed for a while now. It's a very attractive screen saver, isn't too distracting, and my 14 month old daughter Mishca loves it. She has a good shot at saying, "Butterflies!". I poked around a bit more and found that White Knight Logic has a few other nice screen savers that are also worth downloading. Whats your favorite OSX screen saver?

Thursday, September 4, 2008

My Psychic Inner Child

Damn my Psychic Inner Child, he (or is it a she??!) let me down once again. We had a great meeting with a client a few days ago, and we're busily putting together an estimate to do the project. Yet we are still raising questions!! Why didn't my psychic inner child fast forward a few days and see what we had dug up in the analysis, and then whisper them to me that I needed to ask these questions in the meeting? Big let down this time, psychic inner child.