Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

trying to run "rake test" within rails source code

I just cloned the rails source code from github, and attempted to run the test suite... I got major failures:

patrick@vincent:~/coding/rails/rails(master)>bundle exec rake test --trace
** Invoke test (first_time)
** Execute test
/Users/patrick/.rvm/rubies/ruby-1.9.2-p180/bin/ruby -w -I"lib:test" -I"/Users/patrick/.rvm/gems/ruby-1.9.2-p180@rails_patch/gems/rake-0.9.2.2/lib" "/Users/patrick/.rvm/gems/ruby-1.9.2-p180@rails_patch/gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb" "test/**/*_test.rb" 
/Users/patrick/coding/rails/rails/activesupport/lib/active_support/test_case.rb:20:in `<class:TestCase>': undefined method `register_spec_type' for ActiveSupport::TestCase:Class (NoMethodError)
    from /Users/patrick/coding/rails/rails/activesupport/lib/active_support/test_case.rb:11:in `<module:ActiveSupport>'
    from /Users/patrick/coding/rails/rails/activesupport/lib/active_support/test_case.rb:10:in `<top (required)>'
    from /Users/patrick/coding/rails/rails/activesupport/test/benchmarkable_test.rb:3:in `<top (required)>'
    from /Users/patrick/.rvm/gems/ruby-1.9.2-p180@rails_patch/gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb:10:in `require'
    from /Users/patrick/.rvm/gems/ruby-1.9.2-p180@rails_patch/gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb:10:in `block (2 levels) in <main>'
    from /Users/patrick/.rvm/gems/ruby-1.9.2-p180@rails_patch/gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb:9:in `each'
    from /Users/patrick/.rvm/gems/ruby-1.9.2-p180@rails_patch/gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb:9:in `block in <main>'
    from /Users/patrick/.rvm/gems/ruby-1.9.2-p180@rails_patch/gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb:4:in `select'
    from /Users/patrick/.rvm/gems/ruby-1.9.2-p180@rails_patch/gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb:4:in `<main>'
rake aborted!
Command failed with status (1): [/Users/patrick/.rvm/rubies/ruby-1.9.2-p180...]

Tasks: TOP => test
(See full trace by running task with --trace)

And there's a lot more similar error output after that which looks fairly identical so I won't bother pasting it here...

Does anyone know how I can get these tests to run?

like image 850
patrick Avatar asked Feb 04 '12 08:02

patrick


1 Answers

You are running under ruby 1.9.2. The rails master branch (aka Rails 4) requires ruby 1.9.3 or greater. The missing method register_spec_type will be resolved by ruby 1.9.3.

I see you are using RVM, which is great. That will make upgrading to 1.9.3 easy...

Depending on how old your copy of RVM is, you may need to upgrade it with:

$ rvm get stable

Then, make sure you have ruby 1.9.3 installed and that you are using it:

$ rvm install 1.9.3
$ rvm use 1.9.3

You will probably need to reinstall all the gems in the bundle:

$ bundle install

Now you should be able to run the tests successfully with:

$ bundle exec rake test
like image 83
scottwb Avatar answered Sep 22 '22 11:09

scottwb