Add empty line after guard claues
This commit is contained in:
parent
f5a9f9ea12
commit
1054005906
|
@ -27,6 +27,7 @@ module Capybara
|
|||
|
||||
def threadsafe=(bool)
|
||||
raise 'Threadsafe setting cannot be changed once a session is created' if (bool != threadsafe) && Session.instance_created?
|
||||
|
||||
@threadsafe = bool
|
||||
end
|
||||
|
||||
|
|
|
@ -87,6 +87,7 @@ module Capybara
|
|||
|
||||
def expired?
|
||||
raise Capybara::FrozenInTime, 'Time appears to be frozen. Capybara does not work with libraries which freeze time, consider using time travelling instead' if stalled?
|
||||
|
||||
current - @start >= @expire_in
|
||||
end
|
||||
|
||||
|
|
|
@ -274,6 +274,7 @@ module Capybara
|
|||
find(:select, from, options)
|
||||
rescue Capybara::ElementNotFound => select_error
|
||||
raise if %i[selected with_selected multiple].any? { |option| options.key?(option) }
|
||||
|
||||
begin
|
||||
find(:datalist_input, from, options)
|
||||
rescue Capybara::ElementNotFound => dlinput_error
|
||||
|
@ -287,6 +288,7 @@ module Capybara
|
|||
datalist_options = input.evaluate_script(DATALIST_OPTIONS_SCRIPT)
|
||||
option = datalist_options.find { |opt| opt.values_at('value', 'label').include?(value) }
|
||||
raise ::Capybara::ElementNotFound, %(Unable to find datalist option "#{value}") unless option
|
||||
|
||||
input.set(option['value'])
|
||||
rescue ::Capybara::NotSupportedByDriverError
|
||||
# Implement for drivers that don't support JS
|
||||
|
@ -299,6 +301,7 @@ module Capybara
|
|||
visible_css = { opacity: 1, display: 'block', visibility: 'visible' } if visible_css == true
|
||||
_update_style(element, visible_css)
|
||||
raise ExpectationNotMet, 'The style changes in :make_visible did not make the file input visible' unless element.visible?
|
||||
|
||||
begin
|
||||
yield element
|
||||
ensure
|
||||
|
@ -326,6 +329,7 @@ module Capybara
|
|||
el.set(checked)
|
||||
rescue StandardError => err
|
||||
raise unless allow_label_click && catch_error?(err)
|
||||
|
||||
begin
|
||||
el ||= find(selector, locator, options.merge(visible: :all))
|
||||
el.session.find(:label, for: el, visible: true).click unless el.checked? == checked
|
||||
|
|
|
@ -84,6 +84,7 @@ module Capybara
|
|||
session.raise_server_error!
|
||||
raise err unless driver.wait? && catch_error?(err, errors)
|
||||
raise err if timer.expired?
|
||||
|
||||
sleep(0.05)
|
||||
reload if session_options.automatic_reload
|
||||
retry
|
||||
|
|
|
@ -84,6 +84,7 @@ module Capybara
|
|||
def style(*styles)
|
||||
styles = styles.flatten.map(&:to_s)
|
||||
raise ArgumentError, 'You must specify at least one CSS style' if styles.empty?
|
||||
|
||||
begin
|
||||
synchronize { base.style(styles) }
|
||||
rescue NotImplementedError => err
|
||||
|
@ -113,6 +114,7 @@ module Capybara
|
|||
# @return [Capybara::Node::Element] The element
|
||||
def set(value, **options)
|
||||
raise Capybara::ReadOnlyElementError, "Attempt to set readonly element with value: #{value}" if readonly?
|
||||
|
||||
options = session_options.default_set_options.to_h.merge(options)
|
||||
synchronize { base.set(value, options) }
|
||||
self
|
||||
|
@ -442,6 +444,7 @@ module Capybara
|
|||
%(#<Capybara::Node::Element tag="#{base.tag_name}">)
|
||||
rescue StandardError => err
|
||||
raise unless session.driver.invalid_element_errors.any? { |et| err.is_a?(et) }
|
||||
|
||||
%(Obsolete #<Capybara::Node::Element>)
|
||||
end
|
||||
|
||||
|
|
|
@ -252,10 +252,12 @@ module Capybara
|
|||
synchronize(query.wait) do
|
||||
result = query.resolve_for(self)
|
||||
raise Capybara::ExpectationNotMet, result.failure_message unless result.matches_count?
|
||||
|
||||
result
|
||||
end
|
||||
rescue Capybara::ExpectationNotMet
|
||||
raise if minimum_specified || (result.compare_count == 1)
|
||||
|
||||
Result.new([], nil)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -182,6 +182,7 @@ module Capybara
|
|||
|
||||
def option_value(option)
|
||||
return nil if option.nil?
|
||||
|
||||
option[:value] || option.content
|
||||
end
|
||||
end
|
||||
|
|
|
@ -51,6 +51,7 @@ module Capybara
|
|||
return false if options[:maximum] && (Integer(options[:maximum]) < count)
|
||||
return false if options[:minimum] && (Integer(options[:minimum]) > count)
|
||||
return false if options[:between] && !options[:between].include?(count)
|
||||
|
||||
true
|
||||
end
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ module Capybara
|
|||
unless invalid_options.empty?
|
||||
raise ArgumentError, "Match queries don't support quantity options. Invalid keys - #{invalid_options.join(', ')}"
|
||||
end
|
||||
|
||||
super
|
||||
end
|
||||
|
||||
|
|
|
@ -59,8 +59,10 @@ module Capybara
|
|||
|
||||
def matches_filters?(node)
|
||||
return true if (@resolved_node&.== node) && options[:allow_self]
|
||||
|
||||
@applied_filters ||= :system
|
||||
return false unless matches_text_filter?(node) && matches_exact_text_filter?(node) && matches_visible_filter?(node)
|
||||
|
||||
@applied_filters = :node
|
||||
matches_node_filters?(node) && matches_filter_block?(node)
|
||||
rescue *(node.respond_to?(:session) ? node.session.driver.invalid_element_errors : [])
|
||||
|
@ -174,6 +176,7 @@ module Capybara
|
|||
|
||||
def matches_filter_block?(node)
|
||||
return true unless @filter_block
|
||||
|
||||
if node.respond_to?(:session)
|
||||
node.session.using_wait_time(0) { @filter_block.call(node) }
|
||||
else
|
||||
|
@ -203,6 +206,7 @@ module Capybara
|
|||
unless VALID_MATCH.include?(match)
|
||||
raise ArgumentError, "invalid option #{match.inspect} for :match, should be one of #{VALID_MATCH.map(&:inspect).join(', ')}"
|
||||
end
|
||||
|
||||
unhandled_options = @options.keys.reject do |option_name|
|
||||
valid_keys.include?(option_name) ||
|
||||
expression_filters.any? { |_name, ef| ef.handles_option? option_name } ||
|
||||
|
@ -210,6 +214,7 @@ module Capybara
|
|||
end
|
||||
|
||||
return if unhandled_options.empty?
|
||||
|
||||
invalid_names = unhandled_options.map(&:inspect).join(', ')
|
||||
valid_names = (valid_keys - [:allow_self]).map(&:inspect).join(', ')
|
||||
raise ArgumentError, "invalid keys #{invalid_names}, should be one of #{valid_names}"
|
||||
|
@ -258,6 +263,7 @@ module Capybara
|
|||
if options[:id].is_a?(XPath::Expression)
|
||||
raise ArgumentError, 'XPath expressions are not supported for the :id filter with CSS based selectors'
|
||||
end
|
||||
|
||||
"##{::Capybara::Selector::CSS.escape(options[:id])}"
|
||||
end
|
||||
|
||||
|
@ -294,6 +300,7 @@ module Capybara
|
|||
|
||||
def warn_exact_usage
|
||||
return unless options.key?(:exact) && !supports_exact?
|
||||
|
||||
warn "The :exact option only has an effect on queries using the XPath#is method. Using it with the query \"#{expression}\" has no effect."
|
||||
end
|
||||
|
||||
|
@ -317,12 +324,14 @@ module Capybara
|
|||
value = options[:text]
|
||||
return true unless value
|
||||
return matches_text_exactly?(node, value) if exact_text == true
|
||||
|
||||
regexp = value.is_a?(Regexp) ? value : Regexp.escape(value.to_s)
|
||||
matches_text_regexp?(node, regexp)
|
||||
end
|
||||
|
||||
def matches_exact_text_filter?(node)
|
||||
return true unless exact_text.is_a?(String)
|
||||
|
||||
matches_text_exactly?(node, exact_text)
|
||||
end
|
||||
|
||||
|
|
|
@ -64,6 +64,7 @@ module Capybara
|
|||
insensitive_regexp = Capybara::Helpers.to_regexp(@expected_text, options: Regexp::IGNORECASE)
|
||||
insensitive_count = @actual_text.scan(insensitive_regexp).size
|
||||
return if insensitive_count == @count
|
||||
|
||||
"it was found #{insensitive_count} #{Capybara::Helpers.declension('time', 'times', insensitive_count)} using a case insensitive search"
|
||||
end
|
||||
|
||||
|
@ -71,6 +72,7 @@ module Capybara
|
|||
invisible_text = text(query_type: :all)
|
||||
invisible_count = invisible_text.scan(@search_regexp).size
|
||||
return if invisible_count == @count
|
||||
|
||||
"it was found #{invisible_count} #{Capybara::Helpers.declension('time', 'times', invisible_count)} including non-visible text"
|
||||
rescue StandardError
|
||||
# An error getting the non-visible text (if element goes out of scope) should not affect the response
|
||||
|
|
|
@ -35,6 +35,7 @@ class Capybara::RackTest::Browser
|
|||
|
||||
def follow(method, path, **attributes)
|
||||
return if fragment_or_script?(path)
|
||||
|
||||
process_and_follow_redirects(method, path, attributes, 'HTTP_REFERER' => current_url)
|
||||
end
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@ class Capybara::RackTest::Driver < Capybara::Driver::Base
|
|||
|
||||
def initialize(app, **options)
|
||||
raise ArgumentError, 'rack-test requires a rack application, but none was given' unless app
|
||||
|
||||
@app = app
|
||||
@options = DEFAULT_OPTIONS.merge(options)
|
||||
end
|
||||
|
|
|
@ -50,12 +50,14 @@ class Capybara::RackTest::Node < Capybara::Driver::Node
|
|||
|
||||
def select_option
|
||||
return if disabled?
|
||||
|
||||
deselect_options unless select_node.multiple?
|
||||
native['selected'] = 'selected'
|
||||
end
|
||||
|
||||
def unselect_option
|
||||
raise Capybara::UnselectNotAllowed, 'Cannot unselect option from single select box.' unless select_node.multiple?
|
||||
|
||||
native.remove_attribute('selected')
|
||||
end
|
||||
|
||||
|
|
|
@ -93,6 +93,7 @@ module Capybara
|
|||
min, max = between.minmax
|
||||
size = load_up_to(max + 1)
|
||||
return 0 if between.include? size
|
||||
|
||||
return size <=> min
|
||||
end
|
||||
|
||||
|
@ -130,6 +131,7 @@ module Capybara
|
|||
def load_up_to(num)
|
||||
loop do
|
||||
break if @result_cache.size >= num
|
||||
|
||||
@result_cache << @results_enum.next
|
||||
end
|
||||
@result_cache.size
|
||||
|
|
|
@ -43,6 +43,7 @@ if defined?(::RSpec::Expectations::Version)
|
|||
syncer.synchronize do
|
||||
@evaluator.reset
|
||||
raise ::Capybara::ElementNotFound unless [matcher_1_matches?, matcher_2_matches?].all?
|
||||
|
||||
true
|
||||
end
|
||||
rescue StandardError
|
||||
|
@ -71,6 +72,7 @@ if defined?(::RSpec::Expectations::Version)
|
|||
syncer.synchronize do
|
||||
@evaluator.reset
|
||||
raise ::Capybara::ElementNotFound unless [matcher_1_matches?, matcher_2_matches?].any?
|
||||
|
||||
true
|
||||
end
|
||||
rescue StandardError
|
||||
|
|
|
@ -242,6 +242,7 @@ module Capybara
|
|||
timer = Capybara::Helpers.timer(expire_in: @wait_time)
|
||||
while window.exists?
|
||||
return false if timer.expired?
|
||||
|
||||
sleep 0.05
|
||||
end
|
||||
true
|
||||
|
|
|
@ -106,6 +106,7 @@ module Capybara
|
|||
def add_filter(name, filter_class, *types, matcher: nil, **options, &block)
|
||||
types.each { |type| options[type] = true }
|
||||
raise 'ArgumentError', ':default option is not supported for filters with a :matcher option' if matcher && options[:default]
|
||||
|
||||
if filter_class <= Filters::ExpressionFilter
|
||||
@expression_filters[name] = filter_class.new(name, matcher, block, options)
|
||||
else
|
||||
|
|
|
@ -41,6 +41,7 @@ module Capybara
|
|||
def apply(subject, name, value, skip_value)
|
||||
return skip_value if skip?(value)
|
||||
raise ArgumentError, "Invalid value #{value.inspect} passed to #{self.class.name.split('::').last} #{name}#{" : #{@name}" if @name.is_a?(Regexp)}" unless valid_value?(value)
|
||||
|
||||
if @block.arity == 2
|
||||
@block.call(subject, value)
|
||||
else
|
||||
|
@ -50,6 +51,7 @@ module Capybara
|
|||
|
||||
def valid_value?(value)
|
||||
return true unless @options.key?(:valid_values)
|
||||
|
||||
Array(@options[:valid_values]).any? { |valid| valid === value } # rubocop:disable Style/CaseEquality
|
||||
end
|
||||
end
|
||||
|
|
|
@ -387,6 +387,7 @@ module Capybara
|
|||
|
||||
def default_visibility(fallback = Capybara.ignore_hidden_elements)
|
||||
return @default_visibility unless @default_visibility.nil?
|
||||
|
||||
fallback
|
||||
end
|
||||
|
||||
|
@ -402,6 +403,7 @@ module Capybara
|
|||
|
||||
def locate_field(xpath, locator, **_options)
|
||||
return xpath if locator.nil?
|
||||
|
||||
locate_xpath = xpath # Need to save original xpath for the label wrap
|
||||
locator = locator.to_s
|
||||
attr_matchers = [XPath.attr(:id) == locator,
|
||||
|
|
|
@ -17,6 +17,7 @@ class Capybara::Selenium::Driver < Capybara::Driver::Base
|
|||
warn "Warning: You're using an unsupported version of selenium-webdriver, please upgrade." if Gem.loaded_specs['selenium-webdriver'].version < Gem::Version.new('3.5.0')
|
||||
rescue LoadError => err
|
||||
raise err if err.message !~ /selenium-webdriver/
|
||||
|
||||
raise LoadError, "Capybara's selenium driver is unable to load `selenium-webdriver`, please install the gem and add `gem 'selenium-webdriver'` to your Gemfile if you are using bundler."
|
||||
end
|
||||
|
||||
|
@ -117,6 +118,7 @@ class Capybara::Selenium::Driver < Capybara::Driver::Base
|
|||
# Ensure the page is empty and trigger an UnhandledAlertError for any modals that appear during unload
|
||||
until find_xpath('/html/body/*').empty?
|
||||
raise Capybara::ExpectationNotMet, 'Timed out waiting for Selenium session reset' if timer.expired?
|
||||
|
||||
sleep 0.05
|
||||
end
|
||||
rescue Selenium::WebDriver::Error::UnhandledAlertError, Selenium::WebDriver::Error::UnexpectedAlertOpenError
|
||||
|
@ -184,6 +186,7 @@ class Capybara::Selenium::Driver < Capybara::Driver::Base
|
|||
|
||||
def close_window(handle)
|
||||
raise ArgumentError, 'Not allowed to close the primary window' if handle == window_handles.first
|
||||
|
||||
within_given_window(handle) do
|
||||
browser.close
|
||||
end
|
||||
|
|
|
@ -9,6 +9,7 @@ module Capybara::Selenium::Driver::ChromeDriver
|
|||
super
|
||||
rescue NoMethodError => err
|
||||
raise unless err.message =~ /full_screen_window/
|
||||
|
||||
bridge = browser.send(:bridge)
|
||||
result = bridge.http.call(:post, "session/#{bridge.session_id}/window/fullscreen", {})
|
||||
result['value']
|
||||
|
@ -20,6 +21,7 @@ module Capybara::Selenium::Driver::ChromeDriver
|
|||
super
|
||||
rescue Selenium::WebDriver::Error::UnknownError => err
|
||||
raise unless err.message =~ /failed to change window state/
|
||||
|
||||
# Chromedriver doesn't wait long enough for state to change when coming out of fullscreen
|
||||
# and raises unnecessary error. Wait a bit and try again.
|
||||
sleep 0.5
|
||||
|
|
|
@ -34,6 +34,7 @@ module Capybara::Selenium::Driver::MarionetteDriver
|
|||
|
||||
def switch_to_frame(frame)
|
||||
return super unless frame == :parent
|
||||
|
||||
# geckodriver/firefox has an issue if the current frame is removed from within it
|
||||
# so we have to move to the default_content and iterate back through the frames
|
||||
handles = @frame_handles[current_window_handle]
|
||||
|
|
|
@ -48,6 +48,7 @@ class Capybara::Selenium::Node < Capybara::Driver::Node
|
|||
# Array => an array of keys to send before the value being set, e.g. [[:command, 'a'], :backspace]
|
||||
def set(value, **options)
|
||||
raise ArgumentError, "Value cannot be an Array when 'multiple' attribute is not present. Not a #{value.class}" if value.is_a?(Array) && !multiple?
|
||||
|
||||
case tag_name
|
||||
when 'input'
|
||||
case self[:type]
|
||||
|
@ -79,12 +80,14 @@ class Capybara::Selenium::Node < Capybara::Driver::Node
|
|||
|
||||
def unselect_option
|
||||
raise Capybara::UnselectNotAllowed, 'Cannot unselect option from single select box.' unless select_node.multiple?
|
||||
|
||||
click if selected?
|
||||
end
|
||||
|
||||
def click(keys = [], **options)
|
||||
click_options = ClickOptions.new(keys, options)
|
||||
return native.click if click_options.empty?
|
||||
|
||||
click_with_options(click_options)
|
||||
rescue StandardError => err
|
||||
if err.is_a?(::Selenium::WebDriver::Error::ElementClickInterceptedError) ||
|
||||
|
@ -136,6 +139,7 @@ class Capybara::Selenium::Node < Capybara::Driver::Node
|
|||
|
||||
def disabled?
|
||||
return true unless native.enabled?
|
||||
|
||||
# WebDriver only defines `disabled?` for form controls but fieldset makes sense too
|
||||
tag_name == 'fieldset' && find_xpath('ancestor-or-self::fieldset[@disabled]').any?
|
||||
end
|
||||
|
@ -255,6 +259,7 @@ private
|
|||
def set_date(value) # rubocop:disable Naming/AccessorMethodName
|
||||
value = SettableValue.new(value)
|
||||
return set_text(value) unless value.dateable?
|
||||
|
||||
# TODO: this would be better if locale can be detected and correct keystrokes sent
|
||||
update_value_js(value.to_date_str)
|
||||
end
|
||||
|
@ -262,6 +267,7 @@ private
|
|||
def set_time(value) # rubocop:disable Naming/AccessorMethodName
|
||||
value = SettableValue.new(value)
|
||||
return set_text(value) unless value.timeable?
|
||||
|
||||
# TODO: this would be better if locale can be detected and correct keystrokes sent
|
||||
update_value_js(value.to_time_str)
|
||||
end
|
||||
|
@ -269,6 +275,7 @@ private
|
|||
def set_datetime_local(value) # rubocop:disable Naming/AccessorMethodName
|
||||
value = SettableValue.new(value)
|
||||
return set_text(value) unless value.timeable?
|
||||
|
||||
# TODO: this would be better if locale can be detected and correct keystrokes sent
|
||||
update_value_js(value.to_datetime_str)
|
||||
end
|
||||
|
|
|
@ -11,11 +11,13 @@ class Capybara::Selenium::ChromeNode < Capybara::Selenium::Node
|
|||
if err.message =~ /File not found : .+\n.+/m
|
||||
raise ArgumentError, "Selenium < 3.14 with remote Chrome doesn't support multiple file upload"
|
||||
end
|
||||
|
||||
raise
|
||||
end
|
||||
|
||||
def drag_to(element)
|
||||
return super unless html5_draggable?
|
||||
|
||||
html5_drag_to(element)
|
||||
end
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@ class Capybara::Selenium::MarionetteNode < Capybara::Selenium::Node
|
|||
return super unless browser_version < 61.0
|
||||
|
||||
return true if super
|
||||
|
||||
# workaround for selenium-webdriver/geckodriver reporting elements as enabled when they are nested in disabling elements
|
||||
if %w[option optgroup].include? tag_name
|
||||
find_xpath('parent::*[self::optgroup or self::select]')[0].disabled?
|
||||
|
@ -57,6 +58,7 @@ class Capybara::Selenium::MarionetteNode < Capybara::Selenium::Node
|
|||
|
||||
def drag_to(element)
|
||||
return super unless (browser_version >= 62.0) && html5_draggable?
|
||||
|
||||
html5_drag_to(element)
|
||||
end
|
||||
|
||||
|
|
|
@ -44,6 +44,7 @@ module Capybara
|
|||
|
||||
def responsive?
|
||||
return false if @server_thread&.join(0)
|
||||
|
||||
res = @checker.request { |http| http.get('/__identify__') }
|
||||
|
||||
if res.is_a?(Net::HTTPSuccess) || res.is_a?(Net::HTTPRedirection)
|
||||
|
@ -57,6 +58,7 @@ module Capybara
|
|||
timer = Capybara::Helpers.timer(expire_in: 60)
|
||||
while pending_requests?
|
||||
raise 'Requests did not finish in 60 seconds' if timer.expired?
|
||||
|
||||
sleep 0.01
|
||||
end
|
||||
end
|
||||
|
@ -72,6 +74,7 @@ module Capybara
|
|||
timer = Capybara::Helpers.timer(expire_in: 60)
|
||||
until responsive?
|
||||
raise 'Rack application timed out during boot' if timer.expired?
|
||||
|
||||
@server_thread.join(0.1)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -22,6 +22,7 @@ module Capybara
|
|||
def call(env)
|
||||
@status, @headers, @body = @app.call(env)
|
||||
return [@status, @headers, @body] unless html_content?
|
||||
|
||||
response = Rack::Response.new([], @status, @headers)
|
||||
|
||||
@body.each { |html| response.write insert_disable(html) }
|
||||
|
|
|
@ -76,11 +76,13 @@ module Capybara
|
|||
|
||||
def initialize(mode, app = nil)
|
||||
raise TypeError, 'The second parameter to Session::new should be a rack app if passed.' if app && !app.respond_to?(:call)
|
||||
|
||||
@@instance_created = true
|
||||
@mode = mode
|
||||
@app = app
|
||||
if block_given?
|
||||
raise 'A configuration block is only accepted when Capybara.threadsafe == true' unless Capybara.threadsafe
|
||||
|
||||
yield config
|
||||
end
|
||||
@server = if config.run_server && @app && driver.needs_server?
|
||||
|
@ -138,6 +140,7 @@ module Capybara
|
|||
#
|
||||
def raise_server_error!
|
||||
return unless @server&.error
|
||||
|
||||
# Force an explanation for the error being raised as the exception cause
|
||||
begin
|
||||
if config.raise_server_errors
|
||||
|
@ -468,6 +471,7 @@ module Capybara
|
|||
def switch_to_window(window = nil, **options, &window_locator)
|
||||
raise ArgumentError, '`switch_to_window` can take either a block or a window, not both' if window && block_given?
|
||||
raise ArgumentError, '`switch_to_window`: either window or block should be provided' if !window && !block_given?
|
||||
|
||||
unless scopes.last.nil?
|
||||
raise Capybara::ScopeError, '`switch_to_window` is not supposed to be invoked from '\
|
||||
'`within` or `within_frame` blocks.'
|
||||
|
@ -769,6 +773,7 @@ module Capybara
|
|||
#
|
||||
def configure
|
||||
raise 'Session configuration is only supported when Capybara.threadsafe == true' unless Capybara.threadsafe
|
||||
|
||||
yield config
|
||||
end
|
||||
|
||||
|
|
|
@ -78,12 +78,14 @@ module Capybara
|
|||
remove_method :app_host=
|
||||
def app_host=(url)
|
||||
raise ArgumentError, "Capybara.app_host should be set to a url (http://www.example.com). Attempted to set #{url.inspect}." if url && url !~ URI::DEFAULT_PARSER.make_regexp
|
||||
|
||||
@app_host = url
|
||||
end
|
||||
|
||||
remove_method :default_host=
|
||||
def default_host=(url)
|
||||
raise ArgumentError, "Capybara.default_host should be set to a url (http://www.example.com). Attempted to set #{url.inspect}." if url && url !~ URI::DEFAULT_PARSER.make_regexp
|
||||
|
||||
@default_host = url
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue