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
@vincentpaca
Copy link
Author

It seems that most rake db tasks fail. Tasks don't break when using Ruby 1.9.2.

@burisu
Copy link

burisu commented Jan 3, 2012

Hello,

I'm not sure that would help a lot, but I got the same issue with Ruby 1.9.3p0, Rails 3.0.11, Rake 0.9.2.2 on every tasks when RAILS_ENV is set to "test". And like in your example, it works with Rails 1.9.2.

brice@thalie:~/dev/ekylibre$ ruby -v
ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-linux]
brice@thalie:~/dev/ekylibre$ rails -v
Rails 3.0.11
brice@thalie:~/dev/ekylibre$ rake -V
rake, version 0.9.2.2
brice@thalie:~/dev/ekylibre$ rake about
/home/brice/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.0.11/lib/active_support/dependencies.rb:239:in `block in require': iconv will be deprecated in the future, use String#encode instead.
About your application's environment
Ruby version              1.9.3 (x86_64-linux)
RubyGems version          1.8.10
Rack version              1.2
Rails version             3.0.11
Active Record version     3.0.11
Action Pack version       3.0.11
Active Resource version   3.0.11
Action Mailer version     3.0.11
Active Support version    3.0.11
Middleware                ActionDispatch::Static, Rack::Lock, ActiveSupport::Cache::Strategy::LocalCache, Rack::Runtime, Rails::Rack::Logger, ActionDispatch::ShowExceptions, ActionDispatch::RemoteIp, Rack::Sendfile, ActionDispatch::Callbacks, ActiveRecord::ConnectionAdapters::ConnectionManagement, ActiveRecord::QueryCache, ActionDispatch::Cookies, ActiveRecord::SessionStore, ActionDispatch::Flash, ActionDispatch::ParamsParser, Rack::MethodOverride, ActionDispatch::Head, ActionDispatch::BestStandardsSupport
Application root          /home/brice/dev/ekylibre
Environment               development
Database adapter          postgresql
Database schema version   20101123095131
brice@thalie:~/dev/ekylibre$ rake about RAILS_ENV=test
/home/brice/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.0.11/lib/active_support/dependencies.rb:239:in `block in require': iconv will be deprecated in the future, use String#encode instead.
About your application's environment
Ruby version              1.9.3 (x86_64-linux)
RubyGems version          1.8.10
Rack version              1.2
Rails version             3.0.11
Active Record version     3.0.11
Action Pack version       3.0.11
Active Resource version   3.0.11
Action Mailer version     3.0.11
Active Support version    3.0.11
Middleware                ActionDispatch::Static, Rack::Lock, ActiveSupport::Cache::Strategy::LocalCache, Rack::Runtime, Rails::Rack::Logger, ActionDispatch::ShowExceptions, ActionDispatch::RemoteIp, Rack::Sendfile, ActionDispatch::Callbacks, ActiveRecord::ConnectionAdapters::ConnectionManagement, ActiveRecord::QueryCache, ActionDispatch::Cookies, ActiveRecord::SessionStore, ActionDispatch::Flash, ActionDispatch::ParamsParser, Rack::MethodOverride, ActionDispatch::Head, ActionDispatch::BestStandardsSupport
Application root          /home/brice/dev/ekylibre
Environment               test
Database adapter          postgresql
Database schema version   20101123095131
/home/brice/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/test/unit.rb:167:in `block in non_options': file not found: about (ArgumentError)
    from /home/brice/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/test/unit.rb:146:in `map!'
    from /home/brice/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/test/unit.rb:146:in `non_options'
    from /home/brice/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/test/unit.rb:207:in `non_options'
    from /home/brice/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/test/unit.rb:52:in `process_args'
    from /home/brice/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/minitest/unit.rb:891:in `_run'
    from /home/brice/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/minitest/unit.rb:884:in `run'
    from /home/brice/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/test/unit.rb:21:in `run'
    from /home/brice/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/test/unit.rb:326:in `block (2 levels) in autorun'
    from /home/brice/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/test/unit.rb:27:in `run_once'
    from /home/brice/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/test/unit.rb:325:in `block in autorun'

@vincentpaca
Copy link
Author

Hey,

I figured that with regards to tasks, db migration etc., 1.9.3 looks like it blew up and failed to finish the task but it actually completed.
I tried to do rake db:migrate on mine, it still showed the same 'block in non_options' error but actually it finished the migration.

Have you seen this?
jimweirich/rake#51

I still haven't found a way to fix these errors though.

@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