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:plugins boots rails twice

#2770

I have created a few plugins, and I can run 'rake test' from inside their dirs just fine. But once I am using them in a Rails project, and try 'rake test:plugins', I was getting this weird message from rake, saying that my test_* functions were already defined.
After messing around a bit, I noticed that, when test:plugins is run, Rails will execute the code in config/boot twice.
Here is a simple example:

$ rails temp $ cd temp $ ./script/generate plugin foobar edit config/boot.rb:

 def boot!
  unless booted?
    puts "TEST_STRING!!!"
    preinitialize
    pick_boot.run
  end

nicolae:temp zeh$ rake test:plugins
(in /Users/zeh/temp) TEST_STRING!!!
/opt/local/bin/ruby -I"lib:test" "/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader.rb" "vendor/plugins/foobar/test/foobar_test.rb" TEST_STRING!!!
Loaded suite /opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader
Started
. Finished in 0.03464 seconds.

1 tests, 1 assertions, 0 failures, 0 errors

that string will show up twice. the same doesn't happen with other rake tasks, like db:migrate, db:drop:all, test, gem -- nor while running console or server (only once).

I might be mistaken, but I don't think that's the desired behavior.

Reported by Jose Otavio R. Ferreira · June 6th, 2009 @ 01:00 AM

State: stale
Milestone: 3.x
Assigned to: nobody
Importance: none

Activity

  1. Jose Otavio R. Ferreira
    Jose Otavio R. Ferreira

    bad formatting of last msg...

    nicolae:~ zeh$ rails temp
    nicolae:~ zeh$ cd temp
    nicolae:temp zeh$ ./script/generate plugin foobar
    

    edit config/boot.rb:

    def boot!
      unless booted?

    puts "TEST_STRING!!!"
    preinitialize
    pick_boot.run
    
    
    
    
    end end
    nicolae:temp zeh$ rake test:plugins
    (in /Users/zeh/temp)
    TEST_STRING!!!
    /opt/local/bin/ruby -I"lib:test" "/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader.rb" "vendor/plugins/foobar/test/foobar_test.rb" 
    TEST_STRING!!!
    Loaded suite /opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader
    Started
    .
    Finished in 0.03464 seconds.
    
    1 tests, 1 assertions, 0 failures, 0 errors
    

    June 6th, 2009 @ 01:09 AM

  2. Jeremy Kemper
    Jeremy Kemper
    • Milestone changed from 2.x to 3.x

    May 4th, 2010 @ 06:48 PM

  3. Rohit Arondekar
    Rohit Arondekar
    • State changed from new to stale
    • Importance changed from to

    Marking ticket as stale. If this is still an issue please leave a comment with suggested changes, creating a patch with tests, rebasing an existing patch or just confirming the issue on a latest release or master/branches.

    October 9th, 2010 @ 04:05 AM

  4. bingbing