NoMethodError in Rails Tests — Fun With Fixtures

In case there’s this weird error message when running unit tests for a Rails app, chances are that your fixtures need some attention. Especially if the schema changed…

NoMethodError: undefined method ‘name’ for #

method method_missing in test_process.rb at line 511
method method_missing in test_case.rb at line 158
method rescue in run in setup_and_teardown.rb at line 26
method run in setup_and_teardown.rb at line 33
method block (2 levels) in run_test_suites in unit.rb at line 641
method each in unit.rb at line 635
method block in run_test_suites in unit.rb at line 635
method each in unit.rb at line 634
method run_test_suites in unit.rb at line 634
method run in unit.rb at line 594
method block in autorun in unit.rb at line 492

There’s no test method given, because, well the tests don’t even get that far: It’s likely that there’s a key (column name) given in the fixture, which is not in the DB schema (anymore).

Advertisement

Citation of the Day

In his keynote this morning David Heinemeier-Hansson described legacy software as ‘a thing of the past, we don’t like’. For now that’s my favourite quotation of this RailsConfEurope.

Other than that: Roderick van Domburg of Nedforce gave interesting hints at a metric reporting tool for Rails and Saikuro, a cyclomatic complexity analyzer written in Ruby.

Berlin – Day 2 / Cute Knut and more

One of the sightseeing program was ‘cute Knut’ the young polar bear in the Berlin Zoo. And then today will also see ‘Bratwurst on Rails’. Meanwhile there’s still lunch, a boat trip and some more preparation for my RejectConf talk.So much to do and see — but so little time…

See you at the Bratwurst event.

PS: I remember an e-mail with proposed tag to use for blogging about RailsConf Europe — but can’t remember what exactly some suggestions where… Can someone please give a hint?

Berlin – Day 1 / pre RailsConf Europe 2007

A great city. Huge in fact. And the hotel is great too: Located in the centre of the city, just a few minutes walk away from the Kalkscheune, the location of Bratwurst on Rails (which unfortunately seem to be down at the time of this writing [2007-09-16T09:48:37+02:00]. And the RailsConf Europe 2007 hotel is just a little bit further down the street close to the train station Friedrichstraße. Another plus for the hotel: Wireless network is free. 🙂

Hmm, I received a letter from the RailsConf organisers with a suggestion of what tags to use, if only I printed that out at home.