【问题标题】:rspec-rails 2.14.2 with Rails 4.2 InvalidURIErrorrspec-rails 2.14.2 与 Rails 4.2 InvalidURIError
【发布时间】:2015-01-27 20:36:47
【问题描述】:

我的 Gemfile 中有 gem 'rspec-rails', '~> 2.14.2'
从 Rails 4.1 升级到 Rails 4.2 后,我在运行 rspec 时遇到以下错误:

Failure/Error: get 'api/...'
URI::InvalidURIError:
  the scheme http does not accept registry part: www.example.com:80api (or bad hostname?)

解决方法是什么?

【问题讨论】:

    标签: rspec2 rspec-rails ruby-on-rails-4.2


    【解决方案1】:

    / 添加到路径可以解决问题。

    例如:
    get 'api/...' => get '/api/...'
    post 'api/...' => post '/api/...'
    patch 'api/...' => patch '/api/...'
    put 'api/...' => put '/api/...' 等等

    编辑:解释了原因here

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-01-27
      • 2016-04-25
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多