This project is archived and is in readonly mode.

#2770 ✓stale
Jose Otavio R. Ferreira

rake test:plugins boots rails twice

Reported by Jose Otavio R. Ferreira | June 6th, 2009 @ 01:00 AM | in 3.x

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.

Comments and changes to this ticket

  • Jose Otavio R. Ferreira

    Jose Otavio R. Ferreira June 6th, 2009 @ 01:09 AM

    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
    
  • Jeremy Kemper

    Jeremy Kemper May 4th, 2010 @ 06:48 PM

    • Milestone changed from 2.x to 3.x
  • Rohit Arondekar

    Rohit Arondekar October 9th, 2010 @ 04:05 AM

    • 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.

  • bingbing

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Pages