Addressable :: URI :: InvalidURIError:如果没有设置权限,则不能包含带有两个前导斜杠的路径:' //'

时间:2017-10-03 11:32:00

标签: google-chrome capybara rspec-rails circleci

我们的测试套件在本地传递。但是在Circle CI中,我们使用capybara,Rspec编写的所有集成测试都会收到类似下面的错误。

Failures:

  1) the inspection access When inspector has no access removes inspection from table
     Failure/Error: visit '/'

     Addressable::URI::InvalidURIError:
       Cannot have a path with two leading slashes without an authority set: '//'
     # /home/ubuntu/.bundle_end_to_end/ruby/2.3.0/gems/addressable-2.5.2/lib/addressable/uri.rb:2429:in `validate'
     # /home/ubuntu/.bundle_end_to_end/ruby/2.3.0/gems/addressable-2.5.2/lib/addressable/uri.rb:1538:in `path='
     # /home/ubuntu/.bundle_end_to_end/ruby/2.3.0/gems/capybara-2.15.2/lib/capybara/session.rb:265:in `visit'
     # /home/ubuntu/.bundle_end_to_end/ruby/2.3.0/gems/capybara-2.15.2/lib/capybara/dsl.rb:50:in `block (2 levels) in <module:DSL>'
     # ./spec/support/sessions_management.rb:3:in `sign_in'
     # ./spec/support/sessions_management.rb:19:in `sign_in_as'
     # ./spec/inspection_access_spec.rb:11:in `block (3 levels) in <top (required)>'

  2) the inspection access When inspector has access adds the inspection to the table
     Failure/Error: visit '/'

     Addressable::URI::InvalidURIError:
       Cannot have a path with two leading slashes without an authority set: '//'

Rails 4.2.8和Ruby 2.3.3。知道我们应该在哪里研究?

1 个答案:

答案 0 :(得分:1)

Capybara.app_host设置了尾随'/'(例如Capybara.app_host = "http://www.example.com/")。这在访问'/'时会导致Capybara 2.15.2出现问题。如果可能,请删除尾随的'/'(例如Capybara.app_host = http://www.example.com`),或者回滚到Capybara 2.15.1直到2.15.3发布。