1
0
Fork 0
mirror of https://github.com/teamcapybara/capybara.git synced 2022-11-09 12:08:07 -05:00

parameter cleanup

This commit is contained in:
Thomas Walpole 2017-08-08 05:33:20 -07:00
parent 95c877c5b9
commit 212ecdcfdf
3 changed files with 6 additions and 9 deletions

View file

@ -436,12 +436,12 @@ Capybara.register_server :default do |app, port, _host|
Capybara.run_default_server(app, port)
end
Capybara.register_server :webrick do |app, port, host, options={}|
Capybara.register_server :webrick do |app, port, host, **options|
require 'rack/handler/webrick'
Rack::Handler::WEBrick.run(app, {Host: host, Port: port, AccessLog: [], Logger: WEBrick::Log::new(nil, 0)}.merge(options))
end
Capybara.register_server :puma do |app, port, host, options={}|
Capybara.register_server :puma do |app, port, host, **options|
require 'rack/handler/puma'
Rack::Handler::Puma.run(app, {Host: host, Port: port, Threads: "0:4", workers: 0, daemon: false}.merge(options))
end

View file

@ -24,7 +24,7 @@ module Capybara
descriptions.push block
end
def description(options={})
def description(**options)
options_with_defaults = options.dup
filters.each do |name, filter|
options_with_defaults[name] = filter.default if filter.default? && !options_with_defaults.has_key?(name)

View file

@ -847,9 +847,8 @@ module Capybara
driver.dismiss_modal(type, modal_options(text_or_options, options), &blk)
end
def modal_options(text_or_options, options)
text_or_options, options = nil, text_or_options if text_or_options.is_a?(Hash)
options[:text] ||= text_or_options unless text_or_options.nil?
def modal_options(text=nil, **options)
options[:text] ||= text unless text.nil?
options[:wait] ||= config.default_max_wait_time
options
end
@ -908,9 +907,7 @@ module Capybara
end
end
def _switch_to_window(window = nil, options= {})
options, window = window, nil if window.is_a? Hash
def _switch_to_window(window = nil, **options)
raise Capybara::ScopeError, "Window cannot be switched inside a `within_frame` block" if scopes.include?(:frame)
raise Capybara::ScopeError, "Window cannot be switch inside a `within` block" unless scopes.last.nil?