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.

Rake test executes the test suite three times if the environment variable TEST is set

#3572

To check this behavior just run this under a rails project directory:

rake test TEST=your_favourite_test_here.rb

That file will be ran three times.

I include a patch that solves the problem.

Reported by calavera · December 14th, 2009 @ 07:58 PM

State: resolved
Milestone: none
Assigned to: Xavier Noria Xavier Noria
Importance: Low

Activity

  1. calavera
    calavera
    • Tag changed from 2.x, patch, railties to 2.x, patch, railties, tiny

    December 14th, 2009 @ 08:38 PM

  2. Xavier Noria
    Xavier Noria

    I personally invoke ruby to run a single test, but this patch seems good to go for me. The proposed behavior is consistent with rake's test, and eliminates the weird repetitions.

    December 14th, 2009 @ 09:18 PM

  3. Rohit Arondekar
    Rohit Arondekar
    • State changed from new to open
    • Importance changed from to Low

    This is still an issue on Rails 3.

    ~/projects/rails/actionpack९ rake test TEST=test/controller/send_file_test.rb 
    (in /home/rohit/projects/rails/actionpack)
    Loaded suite /home/rohit/.rvm/gems/ruby-1.9.2-p0@3-dev/gems/rake-0.8.7/lib/rake/rake_test_loader
    Started
    ..............
    Finished in 0.266826 seconds.
    
    14 tests, 43 assertions, 0 failures, 0 errors, 0 skips
    
    Test run options: --seed 28510
    Loaded suite /home/rohit/.rvm/gems/ruby-1.9.2-p0@3-dev/gems/rake-0.8.7/lib/rake/rake_test_loader
    Started
    ..............
    Finished in 0.267281 seconds.
    
    14 tests, 43 assertions, 0 failures, 0 errors, 0 skips
    
    Test run options: --seed 13281
    
    ~/projects/rails/actionpack९ ruby -Itest test/controller/send_file_test.rb 
    Loaded suite test/controller/send_file_test
    Started
    ..............
    Finished in 0.265577 seconds.
    
    14 tests, 43 assertions, 0 failures, 0 errors, 0 skips
    
    Test run options: --seed 38963
    

    Although it's documented in RUNNING_UNIT_TESTS that single tests are to be run using ruby —

    == Running by hand
    
    If you only want to run a single test suite, or don't want to bother with Rake,
    you can do so with something like:
    
       ruby -Itest test/controller/base_tests.rb
    

    I think this should work with Rake as well.

    The patch doesn't apply any more, can somebody please rebase it?

    October 8th, 2010 @ 03:38 AM

  4. Aditya Sanghi
    Aditya Sanghi
    • Assigned user set to Xavier Noria

    Okay, rebased and credit given to David. Please check.

    October 8th, 2010 @ 01:49 PM

  5. Xavier Noria
    Xavier Noria

    There's a typo "EVN", fixing and testing with an app.

    October 10th, 2010 @ 10:49 AM

  6. Repository
    Repository
    • State changed from open to resolved

    October 10th, 2010 @ 11:27 AM