10

gem 'rspec-rails', '~> 2.14.2'的 Gemfile 中有。
从 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?)

解决方法是什么?

4

1 回答 1

16

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

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

编辑:这里解释了原因。

于 2014-11-29T10:38:36.097 回答