5

I'm working on a rails 3.1 engine, and as it's a brand new release and I'm working off of edge, I didn't expect things to go perfectly. I can't seem to get my engine to see the db:test:prepare task when I run bundle exec rake -T

I'm using rake 0.8.7 and edge rails. If I try to require the dummy application's Rakefile, I get

undefined method 'prerequisites' for nil:NilClass on line 7 of spec/dummy/Rakefile

Line 7 of my Rakefile in spec/dummy/ is Dummy::Application.load_tasks

My research so far has brought me to http://www.engineyard.com/blog/2010/rails-3-beta-is-out-a-retrospective/ which corresponds with databases.rake in Active Record.

How do I get the db:test:prepare task into my engine?

3 Answers 3

11

I think you have to prefix with app, so rake app:db:test:prepare, or just rake app:test:prepare.

1
  • 1
    Thanks Kris, I just needed it today, was surprised when I saw who post the proper answer. Best, Aleks from Warsaw :)
    – tjeden
    Mar 17, 2017 at 9:39
4

Looks like http://blog.davidchelimsky.net/2011/05/22/rspec-rails-261beta1-is-released/ is the answer.

The reason being is that it guards against calling prerequisites on nil and will work with Rails 3.1 RC (or edge at this moment in time).

1
  • Brilliant @Omar. The timing of these posts are insane. Rails 3.1 gets lauched, I fiddle with it, a few hours later the fix pops up in a blog post. Thank you.
    – SpaceGhost
    May 22, 2011 at 11:11
1

As far as I know, then it's just called rake test:prepare in rails 3.1

1
  • It's called that, but how do I get that task into my engine? It's currently sitting in Active Record, and my dummy app Rakefile gives an error when I try to load it. So I can't really get the task.
    – SpaceGhost
    May 22, 2011 at 11:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.