Semergence

Seth Ladd’s blog about Ruby on Rails and crunching data.

Rails Tests With Fixtures Suddenly Stopped Working From Command Line?

with one comment

Now, this is a weird one. I’m hoping someone might have a clue as to why this started.

All of my Rails tests work fine in RadRails. However, if I try to run them from the command line via `rake`, they fail. After much searching, turns out that only the tests with fixtures were failing. And after even more investigation, it turns out that the method `setup_with_fixtures` was never being called. This method is defined in `fixtures.rb`, which also aliases the `setup` method to `setup_with_fixtures`.

To get my tests which use fixtures to work again, I had to place a call to `super` inside my test’s `setup` method. This kicked off `setup_with_fixtures` just fine.

Now, here’s the weird part. This all works without the explicit call to `super` in RadRails. Also, apparently I don’t need this call because the builtin generators don’t include that call.

So, something is happening in the load order on the command line with is altering the behavior of `setup` in tests.

Written by sethladd

December 28, 2006 at 12:44 pm

Posted in fixtures, rubyonrails, tdd

One Response to 'Rails Tests With Fixtures Suddenly Stopped Working From Command Line?'

Subscribe to comments with RSS or TrackBack to 'Rails Tests With Fixtures Suddenly Stopped Working From Command Line?'.

  1. Hi,

    If you could, please update any links to RadRails to point to http://www.aptana.com instead, as the original site is suffering DNS problems.

    Thanks,
    Ingo

    Ingo Muschenetz

    23 Mar 07 at 9:02 pm

Leave a Reply