Watir changes the "ask" highline method

I used some weird features when sharing Watir and Highline.

Here is a simple example:

require 'highline/import'
comp = ask("Company?  ") { |q| q.default = "MySuperCompany" }
puts comp

require 'watir'
comp = ask("Company?  ") { |q| q.default = "MySuperCompany" }
puts comp

Here is the result:

Company?  |MySuperCompany|
MySuperCompany
[Company?  ] =>
Company?

Maybe this is a mistake? I also found in the documentation for highline that

If @question is given before the request (), the called parameters are ignored and this object (must be HighLine :: Question) is used for control instead.

Sorry, I'm not a ruby โ€‹โ€‹guru: - (

+3
source share
1 answer

Confirmed. It really is.

ลฝeljko: http://highline.rubyforge.org/

grundic: Watir, , s4t-utils (http://s4t-utils.rubyforge.org/) "", HighLine "ask". s4t-utils gem "user-choice", , , "commonwatir", Watir. , , "require" watir ", s4t-utils, " ask ".

HighLine.new.ask , "", :

require "highline/import"
comp = ask("Company?  ") { |q| q.default = "MySuperCompany" }
puts comp

require 'watir'
comp = ask("Company?  ") { |q| q.default = "MySuperCompany" }
puts comp

comp = HighLine.new.ask("Company?  ") { |q| q.default = "MySuperCompany" }
puts comp

:

Company?  |MySuperCompany|  my
my
[Company?  ] => my
my
Company?  |MySuperCompany|  my
my

+5

Source: https://habr.com/ru/post/1746972/


All Articles