[Ruby on Rails] uninitialized constant ActiveSupport::~::ForRspec

» Posted by on 4月 21, 2009 in Blog | 0 comments

今日、rails のディレクトリで rake を実行すると↓のエラーが出るようになってしまった。
全く身に覚えがない。

% rake -T
(in /home/ice/messa/hulor)
rake aborted!
uninitialized constant ActiveSupport::Testing::SetupAndTeardown::ForRspec
/home/ice/messa/hulor/Rakefile:12
(See full trace by running task with --trace)

今回の件に関係あると思われる gem のパッケージのバージョン。

  • rails 2.3.2
  • rspec 1.2.4
  • rspec-rails 1.2.4

何をしたらこうなったのか全く覚えてないけど、たぶん rails をプロジェクト内にインストールし直したんだと思う(システムにでななく)。
↓みたいなことをしたのか?覚えてない。

% rake rails:freeze:edge

#801 ‘No such file to load’ when running ‘rake spec’

Sounds like you’ve got rails edge, not rails-2.3.2. These files moved post-2.3.2 – same with ForRspec – that’s all in rails edge, which is now moving towards rails-3.0, and is not supported by rspec yet in any released version, nor in rspec’s own edge.

↑の記事曰く、さっきのコマンドでインストールされてるのは rails の 2.3.2 ではないらしい。
バージョン指定しなくてもうまくいってたのはただのラッキーだったっぽい。
これを直すには、次のコマンドを実行すればOK。

% rake rails:freeze:edge RELEASE=2.3.2
% rake rails:freeze:edge RELEASE=2.3.2
(in /home/ice/messa/hulor)
cd vendor
Downloading Rails from http://dev.rubyonrails.org/archives/rails_2.3.2.zip
Unpacking Rails
rm -rf rails
rm -f rails.zip
rm -f rails/Rakefile
rm -f rails/cleanlogs.sh
rm -f rails/pushgems.rb
rm -f rails/release.rb
touch rails/REVISION_b10fb7e7bcb5efea6c93ae52bad125887cfc235c
cd -
Updating current scripts, javascripts, and configuration settings

直った. //