Skip to content

Instantly share code, notes, and snippets.

@vincentpaca
Created January 2, 2012 07:58
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vincentpaca/1549790 to your computer and use it in GitHub Desktop.
Save vincentpaca/1549790 to your computer and use it in GitHub Desktop.
Ruby 1.9.3p0 Rails 3.1.3 Rake 0.9.2.2 breaks on rake db:migrate
pax@ubuntu:~/projects/missionhub$ ruby -v
ruby 1.9.3p0 (2011-10-30 revision 33570) [i686-linux]
pax@ubuntu:~/projects/missionhub$ rails -v
Rails 3.1.3
pax@ubuntu:~/projects/missionhub$ rake -V
rake, version 0.9.2.2
pax@ubuntu:~/projects/missionhub$ bundle exec rake db:migrate --trace
DEPRECATION WARNING: Yajl's JSON gem compatibility API is going to be removed in 2.0
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Invoke db:load_config (first_time)
** Invoke rails_env (first_time)
** Execute rails_env
** Execute db:load_config
** Execute db:migrate
** Invoke db:schema:dump (first_time)
** Invoke environment
** Invoke db:load_config
** Execute db:schema:dump
/home/pax/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/test/unit.rb:167:in `block in non_options': file not found: db:migrate (ArgumentError)
from /home/pax/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/test/unit.rb:146:in `map!'
from /home/pax/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/test/unit.rb:146:in `non_options'
from /home/pax/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/test/unit.rb:207:in `non_options'
from /home/pax/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/test/unit.rb:52:in `process_args'
from /home/pax/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/minitest/unit.rb:891:in `_run'
from /home/pax/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/minitest/unit.rb:884:in `run'
from /home/pax/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/test/unit.rb:21:in `run'
from /home/pax/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/test/unit.rb:326:in `block (2 levels) in autorun'
from /home/pax/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/test/unit.rb:27:in `run_once'
from /home/pax/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/test/unit.rb:325:in `block in autorun'
#-----------------------------
pax@ubuntu:~/projects/missionhub$ ruby -v
ruby 1.9.2p271 (2011-05-31 revision 31856) [i686-linux]
pax@ubuntu:~/projects/missionhub$ rails -v
Rails 3.1.3
pax@ubuntu:~/projects/missionhub$ bundle exec rake -V
rake, version 0.9.2.2
pax@ubuntu:~/projects/missionhub$ bundle exec rake db:migrate
DEPRECATION WARNING: Yajl's JSON gem compatibility API is going to be removed in 2.0
Loaded suite /home/pax/.rvm/gems/ruby-1.9.2-p180@missionhub/bin/rake
Started
Finished in 0.001118 seconds.
0 tests, 0 assertions, 0 failures, 0 errors, 0 skips
Test run options: --seed 51475
@burisu
Copy link

burisu commented Jan 3, 2012

Like beanieboi, I used shoulda which produces this error. I found that the require 'test/unit' call used in shoulda 2.11.3 and shoulda-context re-runs tests on Ruby 1.9.3. If I comment this line, it seems to work (I tested that with shoulda only).

For now, I fixed the issue by removing shoulda from my Gemfile and by including the code I need from shoulda-context. It's quite ugly, but I'll try to find a better way.

Thank you for the link which helps me.

@joshuasiler
Copy link

I have the same problem and have verified it's a problem with shoulda interaction.

@shedd
Copy link

shedd commented Feb 23, 2012

I also ran into this issue - removing shoulda fixed it. Many thanks!

@flavorjones
Copy link

It's worth pointing out that declaring :require => false in your Gemfile will avoid this problem:

gem "shoulda", :require => false

Then just make sure you require "shoulda" in your spec helper file.

@Irostovsky
Copy link

Yes. It helped! Thank you!

@jwigal
Copy link

jwigal commented Aug 25, 2012

This was helpful. Thank you!

@i3zhe
Copy link

i3zhe commented Sep 10, 2012

cool~ flavorjones' solution works quite well.

@tfwright
Copy link

I ran into this issue with flexmock as well--same fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment