rubygems / rubygems-test

An attempt to replace the testing facility in rubygems via a test plugin.
Other
48 stars 11 forks source link

Pending migrations for an engine #20

Closed GBH closed 13 years ago

GBH commented 13 years ago

Lets say to test my gem I need to run migrations first. Testing db is sqlite so there's no configuration, but rake db:migrate needs to be run before rake test. Any thoughts how it can be accomplished?

(in /Users/oleg/.rvm/gems/ruby-1.9.2-p136/gems/comfortable_mexican_sofa-1.0.42)
You have 1 pending migrations:
     1 CreateCms
Upload these results? [Yn]
erikh commented 13 years ago

Hrm, maybe just don't upload the results if you don't have a sane result? I'm not sure how we could solve this in a reliable way.

GBH commented 13 years ago

Not saying there's something wrong with gem test. I'm just wondering if there's a way to modify my gem so it runs rake db:migrate before rake test automatically.

GBH commented 13 years ago

I think I got it:

namespace :db do
  task :abort_if_pending_migrations => [:migrate]
end

That does the trick.