0

I'm working on a Ruby on Rails project and trying to get RSpec working so i can write some tests. I run the following command:

bundle exec rspec spec/

to run my test. I then get the error

 Migrations are pending; run 'rake db:migrate RAILS_ENV=test' to resolve this issue.

so then i run

rake db:migrate RAILS_ENV=test

and get the following error

Screenshot of the issue

any help would be appreciated!

4
  • Try rake db:test:prepare ? Commented Aug 29, 2013 at 4:04
  • Try creating an empty test db and run the migrations again. You seem to have a conflict with the index. Commented Aug 29, 2013 at 4:06
  • @DamienRoche Thanks! If you want you can move that to the answer so I can accpet it, and give you some Reputation points! Commented Aug 29, 2013 at 4:09
  • Great to hear! Will do. Commented Aug 29, 2013 at 4:11

2 Answers 2

1

The error is misleading. You should never run migrations directly on your test db. Run:

rake db:test:prepare
Sign up to request clarification or add additional context in comments.

Comments

0

This post may be helpful depending on your Rails version: Rake db:test:prepare task deleting data in development database

Rails 3.2.9 may solve your issue.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.