Problem with generated tests

Hi everyone,

This may not be an issue, but I'm just checking. When I generate a scaffold in rails 2.1, all of the tests that get generated have a require 'test_helper' at the top. When you try to run a test individually through command line, you get an error:

$ ruby test/functional/foos_controller_test.rb test/functional/foos_controller_test.rb:1:in `require': no such file to load -- ../test_helper (LoadError)

Obviously changing this to require File.dirname(__FILE__) + "../test_helper" fixes the problem, however is there a rake task that lets you run tasks individually or is this just a bug?

Sorry if I'm being nit-picky, but I like generators and think they should be kept up to date. :slight_smile:

TIA, -Lance

Sorry,

require File.dirname(__FILE__) + "/../test_helper"

I didn't test my test :wink:

Hi Lance --

Ah OK. Thanks Jeff. Sorry for the false alarm.

This sounds like a bug - many users will try to run the test directly either within textmate or their ide, or just by doing 'ruby foo_test.rb'. Using the relative path is the right way to go...

- Rob

У Аўт, 24/06/2008 у 09:40 -0400, Rob Sanheim піша:

This sounds like a bug - many users will try to run the test directly either within textmate or their ide, or just by doing 'ruby foo_test.rb'. Using the relative path is the right way to go...

+1

It's being discussed here: http://github.com/rails/rails/commit/e8170805

Great, only three places to check for core discussion now! Lighthouse, github, and here. :wink:

- Rob

Well, a ticket system and a mailing list are pretty traditional for Open Source projects.

But using your SCM as a messaging platform? Come on, that's taking the social networking thing too far... I pray that I never see the official Twitter channel for an open source project I care about, because I ain't going there...

-- Chad