mirror of
https://github.com/teamcapybara/capybara.git
synced 2022-11-09 12:08:07 -05:00
parameter cleanup
This commit is contained in:
parent
95c877c5b9
commit
212ecdcfdf
3 changed files with 6 additions and 9 deletions
|
@ -436,12 +436,12 @@ Capybara.register_server :default do |app, port, _host|
|
||||||
Capybara.run_default_server(app, port)
|
Capybara.run_default_server(app, port)
|
||||||
end
|
end
|
||||||
|
|
||||||
Capybara.register_server :webrick do |app, port, host, options={}|
|
Capybara.register_server :webrick do |app, port, host, **options|
|
||||||
require 'rack/handler/webrick'
|
require 'rack/handler/webrick'
|
||||||
Rack::Handler::WEBrick.run(app, {Host: host, Port: port, AccessLog: [], Logger: WEBrick::Log::new(nil, 0)}.merge(options))
|
Rack::Handler::WEBrick.run(app, {Host: host, Port: port, AccessLog: [], Logger: WEBrick::Log::new(nil, 0)}.merge(options))
|
||||||
end
|
end
|
||||||
|
|
||||||
Capybara.register_server :puma do |app, port, host, options={}|
|
Capybara.register_server :puma do |app, port, host, **options|
|
||||||
require 'rack/handler/puma'
|
require 'rack/handler/puma'
|
||||||
Rack::Handler::Puma.run(app, {Host: host, Port: port, Threads: "0:4", workers: 0, daemon: false}.merge(options))
|
Rack::Handler::Puma.run(app, {Host: host, Port: port, Threads: "0:4", workers: 0, daemon: false}.merge(options))
|
||||||
end
|
end
|
||||||
|
|
|
@ -24,7 +24,7 @@ module Capybara
|
||||||
descriptions.push block
|
descriptions.push block
|
||||||
end
|
end
|
||||||
|
|
||||||
def description(options={})
|
def description(**options)
|
||||||
options_with_defaults = options.dup
|
options_with_defaults = options.dup
|
||||||
filters.each do |name, filter|
|
filters.each do |name, filter|
|
||||||
options_with_defaults[name] = filter.default if filter.default? && !options_with_defaults.has_key?(name)
|
options_with_defaults[name] = filter.default if filter.default? && !options_with_defaults.has_key?(name)
|
||||||
|
|
|
@ -847,9 +847,8 @@ module Capybara
|
||||||
driver.dismiss_modal(type, modal_options(text_or_options, options), &blk)
|
driver.dismiss_modal(type, modal_options(text_or_options, options), &blk)
|
||||||
end
|
end
|
||||||
|
|
||||||
def modal_options(text_or_options, options)
|
def modal_options(text=nil, **options)
|
||||||
text_or_options, options = nil, text_or_options if text_or_options.is_a?(Hash)
|
options[:text] ||= text unless text.nil?
|
||||||
options[:text] ||= text_or_options unless text_or_options.nil?
|
|
||||||
options[:wait] ||= config.default_max_wait_time
|
options[:wait] ||= config.default_max_wait_time
|
||||||
options
|
options
|
||||||
end
|
end
|
||||||
|
@ -908,9 +907,7 @@ module Capybara
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def _switch_to_window(window = nil, options= {})
|
def _switch_to_window(window = nil, **options)
|
||||||
options, window = window, nil if window.is_a? Hash
|
|
||||||
|
|
||||||
raise Capybara::ScopeError, "Window cannot be switched inside a `within_frame` block" if scopes.include?(:frame)
|
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?
|
raise Capybara::ScopeError, "Window cannot be switch inside a `within` block" unless scopes.last.nil?
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue