Arup Rakshit
Arup Rakshit

Reputation: 118261

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

Our tests suites are passing locally. But in Circle CI we are getting an error like below for all integration tests which we wrote using 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 and Ruby 2.3.3. Any idea where should we look into?

Upvotes: 1

Views: 1006

Answers (1)

Thomas Walpole
Thomas Walpole

Reputation: 49850

You have Capybara.app_host set with a trailing '/' (e.g. Capybara.app_host = "http://www.example.com/" ). This is causing an issue in Capybara 2.15.2 when visiting '/'. Either remove the trailing '/' (e.g. Capybara.app_host =http://www.example.com` ) if possible, or roll back to Capybara 2.15.1 until 2.15.3 is released.

Upvotes: 1

Related Questions