Robot Has No Heart

Xavier Shay blogs here

A robot that does not have a heart

Test setup broken in Rails 2.0.2

Some changes went into rails 2.0.2 that mean the setup method in test subclasses won’t get called. Here’s how it went down:

  • 8392 broke it
  • 8430 tagged 2.0.2
  • 8442 reverted 8392
  • 8445 added a test so it doesn’t break again

You can see some code illustrating the problem in 8445. This affects two plugins that we’re using – helper_test and activemessaging.

For the helper test, the work around is to rename your helper test setup methods to setup_with_fixtures.

1
2
3
def setup_with_fixtures
  super
end

For activemessaging, add the following line to the setup of your functionals that are failing (from the mailing list):

1
ActiveMessaging.reload_activemessaging
  1. Marcus Crafter says:

    Awesome mate, had this exact issue yesterday upgrading another app to Rails 2.0.2 and seeing many test failures – I’d expect a 2.0.3 to be out pretty soon then :)

  2. matt says:

    thank you so much

  3. Gabe says:

    That was a really nasty regression for a double point release. Spent a couple hours trying to figure out what went wrong because I had just done a 10,000 line merge.

  4. Thank you! says:

    Thank you so much for mentioning this bug. It saved me a lot of trouble. I was suspecting some problem with my fixtures when I found your post. That stupid setup method actually was never called. Hope they fix it soon :o).

    Matthias

  5. Dave K. says:

    Dude! Couldn't figure this out last night, couldn't figure it out this morning... tried a different search term and boom, came across your comment on another site. You are glorious. Glory glory!

Post a comment


(lesstile enabled - surround code blocks with ---)

A pretty flower Another pretty flower