確實,這是一個配置問題。 spec/spec_helper.rd指向'測試'環境。 我爲了讓它參考配置/環境/ development.rbRSpec測試失敗
問候
弗雷德
我是新來的回報率,及繼起的邁克爾RoR的3.2教程改成了「發展」哈特爾。 (章3.2.1)
當涉及到執行第一測試,RSpec的返回百 開始與這一個錯誤(和所有期待同更多或更少的 ):
/home/fred/.rvm/gems/[email protected]/gems/activerecord-3.2.1/lib/active_record/connection_adapters/abstract/connection_specification.rb:45:in
`resolve_hash_connection': database configuration does not specify
adapter (ActiveRecord::AdapterNotSpecified)
我的DEV數據庫是PostgreSQL,看起來工作正常(遷移工作正常)。
有人可以幫助我瞭解什麼是錯誤的,並解決它?
謝謝。
的Gemfile:
source 'https://rubygems.org'
gem 'rails', '3.2.1'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'postgres-pr'
gem 'pg'
# gem for test scripts
group :development, :test do
gem 'rspec-rails'
end
group :test do
gem 'capybara', '1.1.2'
end
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
database.yml中:
# PostgreSQL 8.4
development:
adapter: postgresql
encoding: unicode
database: ODQ_APP
pool: 5
環境:
Ruby version 1.9.3 (i686-linux)
RubyGems version 1.8.15
Rack version 1.4
Rails version 3.2.1
JavaScript Runtime Node.js (V8)
Active Record version 3.2.1
Action Pack version 3.2.1
Active Resource version 3.2.1
Action Mailer version 3.2.1
Active Support version 3.2.1
Middleware
ActionDispatch::Static
Rack::Lock
#<ActiveSupport::Cache::Strategy::LocalCache::Middleware:0xa848460>
Rack::Runtime
Rack::MethodOverride
ActionDispatch::RequestId
Rails::Rack::Logger
ActionDispatch::ShowExceptions
ActionDispatch::DebugExceptions
ActionDispatch::RemoteIp
ActionDispatch::Reloader
ActionDispatch::Callbacks
ActiveRecord::ConnectionAdapters::ConnectionManagement
ActiveRecord::QueryCache
ActionDispatch::Cookies
ActionDispatch::Session::CookieStore
ActionDispatch::Flash
ActionDispatch::ParamsParser
ActionDispatch::Head
Rack::ConditionalGet
Rack::ETag
ActionDispatch::BestStandardsSupport
Application root /home/fred/rails_projects/ODQ
Environment development
Database adapter postgresql
Database schema version 20120503135705
弗雷德
是你的整個database.yml嗎?應該有部分測試,你只有發展。 –