环境是REE(2011.12),rvm,rspec 2.8.0,rails 3.0.6和pg 0.13.2.在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"
Run Code Online (Sandbox Code Playgroud)
我正在使用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
Run Code Online (Sandbox Code Playgroud)
我读到了关于这个错误的类似问题.所以我试过rake db:test:prepare或者rake db:test:load,但它没有解决.你有什么主意吗?看起来测试没有在测试数据库上运行......我该怎么办?:(