2014-08-28 2 views
0

Я установил PostgreSQL на компьютере, и это, кажется, работает хорошо для компьютера, но когда я запускаю это:Рубин на 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, и мне нужно его изменить? Я использую окна, и я новичок в 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 
+0

Вы можете оставить spec_helper и static_pages_spec файлы? – Martin

+0

У меня есть сайт на github, https://github.com/ioniz4tion/sample_app/tree/postgre это будет работать? – Zack

+0

Можете ли вы опубликовать файл database.yml –

ответ

0

Похоже, ваш Postgres конфигурации есть проблема. В сообщении ваше условии:

postgres:///zacks-pc\zack holbrook 

Это выглядит как вид URL-адрес Postgres использовать для идентификации базы данных, но сочетание прямой и обратной косой черты (/ против) выглядит странно для меня. Посмотрите на конфигурацию своей базы данных, это, вероятно, происходит оттуда.

0

В вас database.yml файл попробовать, как это, если ваш рабочий на локальном файле

login: &login 
    adapter: postgresql 
    host: localhost 
    username: postgres 
    password: yourpassword! 
    pool: 5 
    encoding: unicode 


development: 
    database: dbname 
    <<: *login 

test: 
    database: dbname 
    <<: *login 

production: 
    database: dbname 
    <<: *login 
Смежные вопросы