capybara 2.15.3 → 2.15.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/History.md +7 -1
 - data/lib/capybara.rb +1 -1
 - data/lib/capybara/session.rb +9 -6
 - data/lib/capybara/spec/session/visit_spec.rb +33 -0
 - data/lib/capybara/spec/session/within_spec.rb +1 -1
 - data/lib/capybara/version.rb +1 -1
 - metadata +2 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: b58346a93d1b784ad960451eea0e16c2cdb5264a
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 6386e073e35c61290e7fdf77353d06f1b887af08
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 5bf103e7ee612aa2ba02f530d77c7cd01430d43df2ac4221a40b8b415e1ccf7f41df84d3ea6795f6629f9d019521169a868dce350c26f4c65d764e92c743f13e
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: e94720fb414e4715748628717a13270372e3e1f1238fb8d36e8811d0060782f86a1ff851fdb1b1e78e8624cd4e3d5c6cb72b6de7af5a5b9276bf4098e15e0717
         
     | 
    
        data/History.md
    CHANGED
    
    | 
         @@ -1,5 +1,11 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # Version 2.15.4
         
     | 
| 
      
 2 
     | 
    
         
            +
            Release date: 2017-10-07
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            ### Fixed
         
     | 
| 
      
 5 
     | 
    
         
            +
            *  Visiting an absolute URL shouldn't overwrite the port when no server or always_include_port=false - Issue #1921
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
       1 
7 
     | 
    
         
             
            # Version 2.15.3
         
     | 
| 
       2 
     | 
    
         
            -
            Release date:  
     | 
| 
      
 8 
     | 
    
         
            +
            Release date: 2017-10-03
         
     | 
| 
       3 
9 
     | 
    
         | 
| 
       4 
10 
     | 
    
         
             
            ### Fixed
         
     | 
| 
       5 
11 
     | 
    
         
             
            *  Visiting '/' when Capybara.app_host has a trailing '/' - Issue #1918 [Thomas Walpole]
         
     | 
    
        data/lib/capybara.rb
    CHANGED
    
    | 
         @@ -69,7 +69,7 @@ module Capybara 
     | 
|
| 
       69 
69 
     | 
    
         
             
                # === Configurable options
         
     | 
| 
       70 
70 
     | 
    
         
             
                #
         
     | 
| 
       71 
71 
     | 
    
         
             
                # [app_host = String/nil]             The default host to use when giving a relative URL to visit, must be a valid URL e.g. http://www.example.com
         
     | 
| 
       72 
     | 
    
         
            -
                # [always_include_port = Boolean]     Whether the Rack server's port should automatically be inserted into every visited URL (Default: false)
         
     | 
| 
      
 72 
     | 
    
         
            +
                # [always_include_port = Boolean]     Whether the Rack server's port should automatically be inserted into every visited URL unless another port is explicitly specified (Default: false)
         
     | 
| 
       73 
73 
     | 
    
         
             
                # [asset_host = String]               Where dynamic assets are hosted - will be prepended to relative asset locations if present (Default: nil)
         
     | 
| 
       74 
74 
     | 
    
         
             
                # [run_server = Boolean]              Whether to start a Rack server for the given Rack app (Default: true)
         
     | 
| 
       75 
75 
     | 
    
         
             
                # [raise_server_errors = Boolean]     Should errors raised in the server be raised in the tests? (Default: true)
         
     | 
    
        data/lib/capybara/session.rb
    CHANGED
    
    | 
         @@ -255,21 +255,24 @@ module Capybara 
     | 
|
| 
       255 
255 
     | 
    
         
             
                    config.app_host && ::Addressable::URI.parse(config.app_host)
         
     | 
| 
       256 
256 
     | 
    
         
             
                  end
         
     | 
| 
       257 
257 
     | 
    
         | 
| 
       258 
     | 
    
         
            -
                  uri_base.port ||= @server.port if @server && config.always_include_port
         
     | 
| 
       259 
     | 
    
         
            -
             
     | 
| 
       260 
258 
     | 
    
         
             
                  if uri_base && [nil, 'http', 'https'].include?(visit_uri.scheme)
         
     | 
| 
       261 
     | 
    
         
            -
                     
     | 
| 
      
 259 
     | 
    
         
            +
                    if visit_uri.relative?
         
     | 
| 
      
 260 
     | 
    
         
            +
                      uri_base.port ||= @server.port if @server && config.always_include_port
         
     | 
| 
      
 261 
     | 
    
         
            +
             
     | 
| 
      
 262 
     | 
    
         
            +
                      visit_uri_parts = visit_uri.to_hash.delete_if { |k,v| v.nil? }
         
     | 
| 
       262 
263 
     | 
    
         | 
| 
       263 
     | 
    
         
            -
                    if visit_uri.scheme.nil?
         
     | 
| 
       264 
264 
     | 
    
         
             
                      # TODO - this is only for compatability with previous 2.x behavior that concatenated
         
     | 
| 
       265 
265 
     | 
    
         
             
                      # Capybara.app_host and a "relative" path - Consider removing in 3.0
         
     | 
| 
       266 
266 
     | 
    
         
             
                      # @abotalov brought up a good point about this behavior potentially being useful to people
         
     | 
| 
       267 
267 
     | 
    
         
             
                      # deploying to a subdirectory and/or single page apps where only the url fragment changes
         
     | 
| 
       268 
268 
     | 
    
         
             
                      visit_uri_parts[:path] = uri_base.path + visit_uri.path
         
     | 
| 
       269 
     | 
    
         
            -
                    end
         
     | 
| 
       270 
269 
     | 
    
         | 
| 
       271 
     | 
    
         
            -
             
     | 
| 
      
 270 
     | 
    
         
            +
                      visit_uri = uri_base.merge(visit_uri_parts)
         
     | 
| 
      
 271 
     | 
    
         
            +
                    else
         
     | 
| 
      
 272 
     | 
    
         
            +
                      visit_uri.port ||= @server.port if @server && config.always_include_port
         
     | 
| 
      
 273 
     | 
    
         
            +
                    end
         
     | 
| 
       272 
274 
     | 
    
         
             
                  end
         
     | 
| 
      
 275 
     | 
    
         
            +
             
     | 
| 
       273 
276 
     | 
    
         
             
                  driver.visit(visit_uri.to_s)
         
     | 
| 
       274 
277 
     | 
    
         
             
                end
         
     | 
| 
       275 
278 
     | 
    
         | 
| 
         @@ -80,8 +80,41 @@ Capybara::SpecHelper.spec '#visit' do 
     | 
|
| 
       80 
80 
     | 
    
         
             
                  @session.visit('/random')
         
     | 
| 
       81 
81 
     | 
    
         
             
                end
         
     | 
| 
       82 
82 
     | 
    
         | 
| 
      
 83 
     | 
    
         
            +
                it "shouldn't override port if no server", requires: [:server] do
         
     | 
| 
      
 84 
     | 
    
         
            +
                  session = Capybara::Session.new(@session.mode, nil)
         
     | 
| 
      
 85 
     | 
    
         
            +
                  expect(session.driver).to receive(:visit).with("http://www.google.com")
         
     | 
| 
      
 86 
     | 
    
         
            +
                  session.visit("http://www.google.com")
         
     | 
| 
      
 87 
     | 
    
         
            +
                end
         
     | 
| 
      
 88 
     | 
    
         
            +
             
     | 
| 
      
 89 
     | 
    
         
            +
                it "shouldn't override port if no server but app_host is set", requires: [:server] do
         
     | 
| 
      
 90 
     | 
    
         
            +
                  session = Capybara::Session.new(@session.mode, nil)
         
     | 
| 
      
 91 
     | 
    
         
            +
                  Capybara.app_host = "http://www.example.com:6666"
         
     | 
| 
      
 92 
     | 
    
         
            +
                  expect(session.driver).to receive(:visit).with("http://www.google.com")
         
     | 
| 
      
 93 
     | 
    
         
            +
                  session.visit("http://www.google.com")
         
     | 
| 
      
 94 
     | 
    
         
            +
                end
         
     | 
| 
      
 95 
     | 
    
         
            +
              end
         
     | 
| 
      
 96 
     | 
    
         
            +
             
     | 
| 
      
 97 
     | 
    
         
            +
              context "when Capybara.always_include_port is false" do
         
     | 
| 
      
 98 
     | 
    
         
            +
                before(:each) do
         
     | 
| 
      
 99 
     | 
    
         
            +
                  Capybara.always_include_port = false
         
     | 
| 
      
 100 
     | 
    
         
            +
                end
         
     | 
| 
      
 101 
     | 
    
         
            +
             
     | 
| 
      
 102 
     | 
    
         
            +
                it "shouldn't overwrite port if app_host is set", requires: [:server] do
         
     | 
| 
      
 103 
     | 
    
         
            +
                  session = Capybara::Session.new(@session.mode, nil)
         
     | 
| 
      
 104 
     | 
    
         
            +
                  Capybara.app_host = "http://www.example.com:6666"
         
     | 
| 
      
 105 
     | 
    
         
            +
                  expect(session.driver).to receive(:visit).with("http://www.google.com")
         
     | 
| 
      
 106 
     | 
    
         
            +
                  session.visit("http://www.google.com")
         
     | 
| 
      
 107 
     | 
    
         
            +
                end
         
     | 
| 
      
 108 
     | 
    
         
            +
             
     | 
| 
      
 109 
     | 
    
         
            +
                it "shouldn't overwrite port if port specfified", requires: [:server] do
         
     | 
| 
      
 110 
     | 
    
         
            +
                  session = Capybara::Session.new(@session.mode, nil)
         
     | 
| 
      
 111 
     | 
    
         
            +
                  Capybara.app_host = "http://www.example.com:6666"
         
     | 
| 
      
 112 
     | 
    
         
            +
                  expect(session.driver).to receive(:visit).with("http://www.google.com:99")
         
     | 
| 
      
 113 
     | 
    
         
            +
                  session.visit("http://www.google.com:99")
         
     | 
| 
      
 114 
     | 
    
         
            +
                end
         
     | 
| 
       83 
115 
     | 
    
         
             
              end
         
     | 
| 
       84 
116 
     | 
    
         | 
| 
      
 117 
     | 
    
         
            +
             
     | 
| 
       85 
118 
     | 
    
         
             
              context "without a server", requires: [:server] do
         
     | 
| 
       86 
119 
     | 
    
         
             
                it "should respect `app_host`" do
         
     | 
| 
       87 
120 
     | 
    
         
             
                  serverless_session = Capybara::Session.new(@session.mode, nil)
         
     | 
| 
         @@ -101,7 +101,7 @@ Capybara::SpecHelper.spec '#within' do 
     | 
|
| 
       101 
101 
     | 
    
         
             
                      expect do
         
     | 
| 
       102 
102 
     | 
    
         
             
                        @session.within(".//div[@id='doesnotexist']") do
         
     | 
| 
       103 
103 
     | 
    
         
             
                        end
         
     | 
| 
       104 
     | 
    
         
            -
                      end.to raise_error(Capybara::ElementNotFound 
     | 
| 
      
 104 
     | 
    
         
            +
                      end.to raise_error(Capybara::ElementNotFound)
         
     | 
| 
       105 
105 
     | 
    
         
             
                    end.to_not change { @session.has_xpath?(".//div[@id='another_foo']") }.from(false)
         
     | 
| 
       106 
106 
     | 
    
         
             
                  end
         
     | 
| 
       107 
107 
     | 
    
         
             
                end.to_not change { @session.has_xpath?(".//div[@id='another_foo']") }.from(true)
         
     | 
    
        data/lib/capybara/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: capybara
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 2.15. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 2.15.4
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Thomas Walpole
         
     | 
| 
         @@ -10,7 +10,7 @@ autorequire: 
     | 
|
| 
       10 
10 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       11 
11 
     | 
    
         
             
            cert_chain:
         
     | 
| 
       12 
12 
     | 
    
         
             
            - gem-public_cert.pem
         
     | 
| 
       13 
     | 
    
         
            -
            date: 2017-10- 
     | 
| 
      
 13 
     | 
    
         
            +
            date: 2017-10-07 00:00:00.000000000 Z
         
     | 
| 
       14 
14 
     | 
    
         
             
            dependencies:
         
     | 
| 
       15 
15 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       16 
16 
     | 
    
         
             
              name: nokogiri
         
     |