kroe761 kroe761 - 1 day ago 5
Ruby Question

((undefined method ` ' NoMethodError)) when using applitools EYES in Ruby/Selenium

I am simply trying to set a constant on the Eyes class, but I get a very strange error. It works when setting the API key, but setting any other constant (like

save_new_tests
,
host_os
, or
match_level
see documentation)) gives me the error below. I don't know what I'm doing differently than when I'm setting the API key. Thanks for your help!

env.rb:

require 'selenium-webdriver'
require 'eyes_selenium'

Before do |scenario|

$driver = Selenium::WebDriver.for :chrome
$driver.manage.window.resize_to(1050, 900)
@eyes = Applitools::Eyes.new
@eyes.api_key = 'my_api_key'
@eyes.save_new_tests = true # <-- Errors here
@eyes.open(app_name: 'my_app', test_name: scenario.title, driver: $driver)

end


Error:

undefined method `  ' for #<Object:0x007fdc778eb740> (NoMethodError)
./features/support/env.rb:10:in `Before'

Answer
▶ '  '.codepoints
#⇒ [
#    [0] 8194,
#    [1] 8194
# ]

The above is a result of me copy-pasting the content of “undefined method” from your error description.

That said, you accidentally have entered unicode en-space (possibly with AltGrSPACE on MacOS, or copy-paste from some web example.) Retype the line manually and everything should work as intended.

Comments