ruby-on-rails – RSpec未通过测试
发布时间:2020-12-16 22:50:51 所属栏目:百科 来源:网络整理
导读:实际上,这是一个配置问题. spec / spec_helper.rd指向’test’环境. 我将其更改为’development’以使其引用config / environments / development.rb 最好的祝福 弗雷德 我是RoR的新手,并遵循Michael Hartl的RoR 3.2教程. 在执行第一次测试时(第3.2.1章),RSp
实际上,这是一个配置问题.
spec / spec_helper.rd指向’test’环境. 我将其更改为’development’以使其引用config / environments / development.rb 最好的祝福 我是RoR的新手,并遵循Michael Hartl的RoR 3.2教程. 在执行第一次测试时(第3.2.1章),RSpec返回一百 /home/fred/.rvm/gems/ruby-1.9.3-p0@ODQ/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 弗雷德 解决方法
你需要解决这个问题
# PostgreSQL 8.4 development: adapter: postgresql encoding: unicode database: ODQ_APP pool: 5 并添加这样的测试部分 # PostgreSQL 8.4 test: adapter: postgresql encoding: unicode database: ODQ_APP_test pool: 5 还记得创建测试db (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |