我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?)
解决方法是什么?
我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?)
解决方法是什么?
添加/
到路径可以解决问题。
例如:
get 'api/...'
=> get '/api/...'
post 'api/...'
=> post '/api/...'
patch 'api/...'
=> patch '/api/...'
put 'api/...'
=>put '/api/...'
等等。
编辑:这里解释了原因。