Thật vậy, đó là sự cố cấu hình. Spec/spec_helper.rd chỉ vào môi trường 'test'. tôi đã thay đổi nó để 'phát triển' để làm cho nó tham khảo config/môi trường/development.rbKiểm tra lỗi RSpec
Trân trọng
Fred
Tôi mới đến ROR, và làm theo tấm Tutorial RoR 3.2 từ Michael Hartl. (. Chap 3.2.1)
Khi nói đến việc thực hiện các thử nghiệm đầu tiên, RSpec trả về một trăm lỗi bắt đầu với cái này (và tất cả tìm kiếm giống nhau nhiều hơn hoặc ít ):
/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)
Cơ sở dữ liệu DEV của tôi là PostgreSQL và có vẻ hoạt động tốt (di chuyển hoạt động tốt).
Ai đó có thể giúp tôi hiểu điều gì sai và giải quyết không?
Cảm ơn.
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
Môi trường:
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
Fred
Đó là toàn bộ database.yml của bạn? Nên có phần để kiểm tra, bạn chỉ có sự phát triển. –