【发布时间】:2023-03-27 09:50:01
【问题描述】:
导轨 3.2.18
mysql2 0.3.18
尝试启动rspec spec
得到了很多:
19) Reports::TaxReportService should properly generate for rests
Failure/Error: Unable to find matching line from backtrace
ActiveRecord::AdapterNotSpecified:
database configuration does not specify adapter
# /home/drobazko/.rvm/gems/ruby-1.9.3-p484/gems/activerecord-3.2.18/lib/active_record/connection_adapters/abstract/connection_specification.rb:47:in `resolve_hash_connection'
# /home/drobazko/.rvm/gems/ruby-1.9.3-p484/gems/activerecord-3.2.18/lib/active_record/connection_adapters/abstract/connection_specification.rb:41:in `resolve_string_connection'
# /home/drobazko/.rvm/gems/ruby-1.9.3-p484/gems/activerecord-3.2.18/lib/active_record/connection_adapters/abstract/connection_specification.rb:27:in `spec'
# /home/drobazko/.rvm/gems/ruby-1.9.3-p484/gems/activerecord-3.2.18/lib/active_record/connection_adapters/abstract/connection_specification.rb:130:in `establish_connection'
# ./spec/support/database_cleaner.rb:18:in `block (2 levels) in <top (required)>'
*database.yml:
# MySQL. Versions 4.1 and 5.0 are recommended.
#
# Install the MYSQL driver
# gem install mysql2
#
# Ensure the MySQL gem is defined in your Gemfile
# gem 'mysql2'
#
# And be sure to use new-style password hashing:
# http://dev.mysql.com/doc/refman/5.0/en/old-client.html
development:
adapter: mysql2
encoding: utf8
reconnect: false
database: mrdelivery_development
pool: 5
username: hd_user
password:
host: localhost
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
adapter: mysql2
encoding: utf8
reconnect: false
database: mrdelivery_test
pool: 5
username: hd_user
password:
host: 127.0.0.1
port: 3306
production:
adapter: mysql2
encoding: utf8
reconnect: false
database: mrdelivery_production
pool: 5
username: hd_user
password:
host: localhost
在开发中一切正常。
【问题讨论】:
-
发布你的整个 database.yml
标签: mysql ruby-on-rails rspec