Archive for July, 2007

On my own …

Monday, July 30th, 2007

Today is my last day at work. Regular salary goes out of the window. Freelance here I come.

I could park a juggernaut in your mouth

Friday, July 20th, 2007

Interesting – a plugin for Rails that uses Flash to push messages to the client (instead of using polling, as Campfire does). I’ve not looked at this at all but I’m sure, if it works, it could be very very useful.

Rails, Unit Tests and setup not working

Tuesday, July 10th, 2007

No posts in a while … there’s a reason for that (very exciting for me, maybe not so much for you, dear reader) – I’ll be telling you my news soon enough.

In the meantime, many thanks to the good folks at the North West Ruby User Group mailing list (I don’t live in the North West but it certainly seems to be a hotbed of Rails action) for helping me out with this one.

It started simply enough. Another day, another controller another functional test.

fixtures :thingies, :wotsits

def setup  super  @thingy = thingies :my_thingyend

def test_something  get :something  assert_response :success  assert_equal @thingy.name, assigns(:page_title)  assert_equal @thingy, assigns(:thingy)end

Open Terminal, type ruby test/functional/thingy_controller_test.rb. Runs fine. All tests pass.

Happy developer.

A bit later, just before committing my changes, type rake test:functionals. Fails. No such method on nil. Nil? Nil? Where does nil come from?

Try running the test on its own? Works fine. Try it in rake? Fails.

I then edited it and added some puts statements in each test and in the setup method. Ran the test on its own – all my text appears as expected. Ran rake – all my text appears except the text from setup. So setup is not being called? But why?

Well, I never found out why but the NWRUG members pinpointed the problem. It was the call to super in setup – apparently there is no method in the super-class and under certain circumstances it never seems to return from this call to the non-existent method. Remove the super and everything runs fine.

Still no explanation as to why it works one way and not the other but at least it works.

I’ve just bought a new computer … it doesn’t work

Thursday, July 5th, 2007

I came across Ed Bott’s column reading an article about how his Steveness is going to rule the world by selling Mac OSX and Windows side-by-side.

And then I stumbled upon his article about how his brand-new (OK, to be fair, refurbed) computer broke shortly after installation. As part of a BIOS update. I don’t know about you but I wouldn’t care whose fault it was … if I had shelled out several hundred dollars on a new piece of kit I would expect it to work – not break within 24 hours.

Fake Steve is a genius

Thursday, July 5th, 2007

Apple is the new Microsoft. iTunes is the new Word.