我的PostgreSQL安裝到計算機上,它似乎在電腦前工作的很好,但是當我運行此:Ruby on Rails的壞URI
$ bundle exec rspec spec/requests/static_pages_spec.rb
它給此錯誤消息
$ bundle exec rspec spec/requests/static_pages_spec.rbL is deprecated, please use Fiddle:/Ruby200-x64/lib/ruby/2.0.0/uri/common.rb:176:in `split': bad URI(is not URI?)
: postgres:///zacks-pc\zack holbrook (URI::InvalidURIError)
from c:/Ruby200-x64/lib/ruby/2.0.0/uri/common.rb:211:in `parse'
from c:/Ruby200-x64/lib/ruby/2.0.0/uri/common.rb:747:in `parse'
from c:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/activerecord-4.0.8/lib/actie_record/connection_adapters/connection_specification.rb:69:in `connection_url_o_hash'
from c:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/activerecord-4.0.8/lib/actie_record/connection_adapters/connection_specification.rb:41:in `block in resolv_string_connection'
from c:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/activerecord-4.0.8/lib/actie_record/connection_adapters/connection_specification.rb:40:in `fetch'
from c:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/activerecord-4.0.8/lib/actie_record/connection_adapters/connection_specification.rb:40:in `resolve_string_onnection'
from c:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/activerecord-4.0.8/lib/actie_record/connection_adapters/connection_specification.rb:32:in `spec'
from c:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/activerecord-4.0.8/lib/actie_record/connection_handling.rb:39:in `establish_connection'
from c:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/activerecord-4.0.8/lib/actie_record/railtie.rb:176:in `block (2 levels) in <class:Railtie>'
from c:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/activesupport-4.0.8/lib/actve_support/lazy_load_hooks.rb:38:in `instance_eval'
from c:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/activesupport-4.0.8/lib/actve_support/lazy_load_hooks.rb:38:in `execute_hook'
from c:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/activesupport-4.0.8/lib/actve_support/lazy_load_hooks.rb:45:in `block in run_load_hooks'
from c:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/activesupport-4.0.8/lib/actve_support/lazy_load_hooks.rb:44:in `each'
from c:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/activesupport-4.0.8/lib/actve_support/lazy_load_hooks.rb:44:in `run_load_hooks'
from c:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/activerecord-4.0.8/lib/actie_record/base.rb:322:in `<module:ActiveRecord>'
from c:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/activerecord-4.0.8/lib/actie_record/base.rb:22:in `<top (required)>'
from c:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/rspec-rails-2.13.1/lib/rspe/rails/extensions/active_record/base.rb:19:in `<module:Extensions>'
from c:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/rspec-rails-2.13.1/lib/rspe/rails/extensions/active_record/base.rb:4:in `<module:Rails>'
from c:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/rspec-rails-2.13.1/lib/rspe/rails/extensions/active_record/base.rb:2:in `<module:RSpec>'
from c:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/rspec-rails-2.13.1/lib/rspe/rails/extensions/active_record/base.rb:1:in `<top (required)>'
from c:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/activesupport-4.0.8/lib/actve_support/dependencies.rb:229:in `require'
from c:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/activesupport-4.0.8/lib/actve_support/dependencies.rb:229:in `block in require'
from c:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/activesupport-4.0.8/lib/actve_support/dependencies.rb:214:in `load_dependency'
from c:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/activesupport-4.0.8/lib/actve_support/dependencies.rb:229:in `require'
from c:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/rspec-rails-2.13.1/lib/rspe/rails/extensions.rb:1:in `<top (required)>'
from c:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/activesupport-4.0.8/lib/actve_support/dependencies.rb:229:in `require'
from c:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/activesupport-4.0.8/lib/actve_support/dependencies.rb:229:in `block in require'
from c:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/activesupport-4.0.8/lib/actve_support/dependencies.rb:214:in `load_dependency'
from c:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/activesupport-4.0.8/lib/actve_support/dependencies.rb:229:in `require'
from c:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/rspec-rails-2.13.1/lib/rspe/rails.rb:9:in `<top (required)>'
from c:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/activesupport-4.0.8/lib/actve_support/dependencies.rb:229:in `require'
from c:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/activesupport-4.0.8/lib/actve_support/dependencies.rb:229:in `block in require'
from c:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/activesupport-4.0.8/lib/actve_support/dependencies.rb:214:in `load_dependency'
from c:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/activesupport-4.0.8/lib/actve_support/dependencies.rb:229:in `require'
from c:/Sites/rails_projects/sample_app/spec/spec_helper.rb:4:in `<top (equired)>'
from c:/Sites/rails_projects/sample_app/spec/requests/static_pages_spec.b:1:in `require'
from c:/Sites/rails_projects/sample_app/spec/requests/static_pages_spec.b:1:in `<top (required)>'
from c:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/rspec-core-2.13.1/lib/rspec/core/configuration.rb:819:in `load'
from c:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/rspec-core-2.13.1/lib/rspec/core/configuration.rb:819:in `block in load_spec_files'
from c:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/rspec-core-2.13.1/lib/rspec/core/configuration.rb:819:in `each'
from c:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/rspec-core-2.13.1/lib/rspec/core/configuration.rb:819:in `load_spec_files'
from c:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/rspec-core-2.13.1/lib/rspec/core/command_line.rb:22:in `run'
from c:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/rspec-core-2.13.1/lib/rspec/core/runner.rb:80:in `run'
from c:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/rspec-core-2.13.1/lib/rspec/core/runner.rb:17:in `block in autorun'
什麼是URI,我需要改變它嗎? 我正在使用Windows,並且是Ruby on Rails的新手,任何幫助將不勝感激,謝謝! 該網站是在Github上:https://github.com/ioniz4tion/sample_app/tree/postgre
的database.yml
development:
adapter: postgresql
encoding: unicode
host: localhost
database: cnh_development
pool: 5
username: cnh
password: my_password
test:
adapter: postgresql
encoding: unicode
host: localhost
database: cnh_test
pool: 5
username: cnh
password: my_password
production:
adapter: postgresql
encoding: unicode
host: localhost
database: cnh_production
pool: 5
username: cnh
password: my_password
您可以發佈您spec_helper和static_pages_spec文件? – Martin 2014-08-28 18:58:43
我在github上的網站,https://github.com/ioniz4tion/sample_app/tree/postgre將工作? – Zack 2014-08-28 19:03:00
你能發佈database.yml文件嗎 – 2014-08-28 19:20:09