Rename option insert_port_into_portless_url to always_include_port and clear up description.
This commit is contained in:
parent
e446d2a9b6
commit
34371fbabb
|
@ -16,7 +16,7 @@ module Capybara
|
|||
class InfiniteRedirectError < TimeoutError; end
|
||||
|
||||
class << self
|
||||
attr_accessor :asset_root, :app_host, :run_server, :default_host, :insert_port_into_portless_url
|
||||
attr_accessor :asset_root, :app_host, :run_server, :default_host, :always_include_port
|
||||
attr_accessor :server_host, :server_port
|
||||
attr_accessor :default_selector, :default_wait_time, :ignore_hidden_elements
|
||||
attr_accessor :save_and_open_page_path, :automatic_reload
|
||||
|
@ -36,7 +36,7 @@ module Capybara
|
|||
#
|
||||
# [asset_root = String] Where static assets are located, used by save_and_open_page
|
||||
# [app_host = String] The default host to use when giving a relative URL to visit
|
||||
# [insert_port_into_portless_url = Boolean] Whether the port should be inserted into a URL that doesn't have one
|
||||
# [always_include_port = Boolean] Whether the Rack server's port should automatically be inserted into every visited URL (Default: false)
|
||||
# [run_server = Boolean] Whether to start a Rack server for the given Rack app (Default: true)
|
||||
# [default_selector = :css/:xpath] Methods which take a selector use the given type by default (Default: CSS)
|
||||
# [default_wait_time = Integer] The number of seconds to wait for asynchronous processes to finish (Default: 2)
|
||||
|
@ -349,6 +349,7 @@ module Capybara
|
|||
end
|
||||
|
||||
Capybara.configure do |config|
|
||||
config.always_include_port = false
|
||||
config.run_server = true
|
||||
config.server {|app, port| Capybara.run_default_server(app, port)}
|
||||
config.default_selector = :css
|
||||
|
|
|
@ -42,7 +42,7 @@ module Capybara
|
|||
(Capybara.app_host || "http://#{host}:#{port}") + path.to_s
|
||||
end
|
||||
|
||||
if Capybara.insert_port_into_portless_url
|
||||
if Capybara.always_include_port
|
||||
uri = URI.parse(path_url)
|
||||
uri.port = port if uri.port == uri.default_port
|
||||
path_url = uri.to_s
|
||||
|
|
|
@ -31,12 +31,12 @@ shared_examples_for "session" do
|
|||
@session.body.should include('Another World')
|
||||
end
|
||||
|
||||
it "should fetch a response from the driver with an absolute url without a port when Capybara.insert_port_into_portless_url is true" do
|
||||
it "should fetch a response from the driver with an absolute url without a port when Capybara.always_include_port is true" do
|
||||
# Preparation
|
||||
@session.visit('/')
|
||||
working_uri = URI.parse(@session.current_url)
|
||||
|
||||
Capybara.insert_port_into_portless_url = true
|
||||
Capybara.always_include_port = true
|
||||
|
||||
@session.visit("http://#{working_uri.host}/")
|
||||
URI.parse(@session.current_url).port.should == working_uri.port
|
||||
|
@ -46,7 +46,7 @@ shared_examples_for "session" do
|
|||
URI.parse(@session.current_url).port.should == working_uri.port
|
||||
@session.body.should include('Another World')
|
||||
|
||||
Capybara.insert_port_into_portless_url = false
|
||||
Capybara.always_include_port = false
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue