環境は、rvm、rspec 2.8.0、rails 3.0.6、および pg 0.13.2 の REE(2011.12) です。CentOS 5.6 で PostgreSQL 8.3.17 を使用しています。db:migrate は正しく機能します。しかし、rspec には次のエラーがあります。
1) ApiController articles OK
Failure/Error: Unable to find matching line from backtrace
ActiveRecord::StatementInvalid:
PG::Error: ERROR: relation "table_name" does not exist
: DELETE FROM "table_name"
プロジェクトをrspec 1.xシリーズのrails 2.3.5からrspec2のrails 3.0に更新しています。すべての rspec テストをコピーし、古い spec_helper.rb と新しいもの (生成されたものrails g rspec:install
) をマージしました。
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
require 'rspec/autorun'
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
RSpec.configure do |config|
config.fixture_path = "#{::Rails.root}/spec/fixtures"
config.use_transactional_fixtures = true
end
このエラーについて同様の質問を読んだので、rake db:test:prepare
または試してみましrake db:test:load
たが、解決しません。何か考えはありますか?テスト データベースでテストが実行されていないようです...どうすればよいですか? :(