Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

script/generate model creates wrong unit test file

#218

For latest edge Rails(Edge Rails revision 2463e38efd3cbcc10e7b0a93ad9c2d2224340668). When you generate model with "script/generate model user"

The file user_test.rb created in test/unit folder do not have line

require File.dirname(__FILE__) + '/../test_helper'
ruby 'test-helper'

which is wrong and so test fail until you make it correct.

Reported by Anil Wadghule · May 18th, 2008 @ 01:32 PM

State: invalid
Milestone: none
Assigned to: nobody
Importance: none

Activity

  1. DHH
    DHH
    • State changed from new to incomplete

    The new approach is to use "ruby -I test user_test.rb".

    May 31st, 2008 @ 10:10 PM

  2. Derek P.
    Derek P.

    so, the old rake-based version is broken now? :(

    June 6th, 2008 @ 05:13 AM

  3. DHH
    DHH

    No, rake does the right thing. The -I is only needed when you run one-off with ruby alone.

    June 6th, 2008 @ 05:21 AM

  4. shuber
    shuber

    I've been changing the require calls back to

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

    so that I can still run the tests with TextMate's RubyMate

    +1

    June 6th, 2008 @ 06:46 AM

  5. Chris Cherry
    Chris Cherry

    This has been annoying me as well. This change doesn't alter other behavior, and allows the running of tests in TextMate!

    +1

    June 6th, 2008 @ 07:12 AM

  6. Jeremy Kemper
    Jeremy Kemper
    • State changed from incomplete to invalid

    Fix TM to pass -Itest or use the rake test task.

    June 6th, 2008 @ 08:31 AM

  7. Aliaksey Kandratsenka
    Aliaksey Kandratsenka

    In comment to http://github.com/rails/rails/co...

    i proposed changing header to:

    ($: << File.expand_path(File.join(File.dirname(FILE), ".."))).uniq!

    require ‘test_helper’

    Another option is to generate full path to test_helper.rb and then #require it.

    How about this ? I really hate creating separate emacs command to lauch tests.

    June 24th, 2008 @ 03:24 PM