cuprite icon indicating copy to clipboard operation
cuprite copied to clipboard

Fix spec helper on MacOS

Open odlp opened this issue 3 years ago • 1 comments

If the detected path to Chrome includes spaces (which it does by default on MacOS) then the version logging in spec/spec_helper.rb would fail, preventing the test suite from running.

Running the following command: bundle exec rspec --dry-run

Before

An error occurred while loading spec_helper.
Failure/Error: puts `#{command.to_a.first} --version`

Errno::ENOENT:
  No such file or directory - /Applications/Google
# ./spec/spec_helper.rb:18:in ``'
# ./spec/spec_helper.rb:18:in `<top (required)>'
No examples found.
No examples found.


Finished in 0.00002 seconds (files took 0.36901 seconds to load)
0 examples, 0 failures, 1 error occurred outside of examples

Finished in 0.00002 seconds (files took 0.36901 seconds to load)
0 examples, 0 failures, 1 error occurred outside of examples

After

Google Chrome 99.0.4844.51

[...]

Finished in 0.0431 seconds (files took 1.03 seconds to load)
1751 examples, 0 failures, 59 pending

Suggested fix

Shellwords.escape escapes the spaces:

Shellwords.escape("/Applications/Google Chrome.app/Contents/MacOS/Google Chrome") # => "/Applications/Google\\ Chrome.app/Contents/MacOS/Google\\ Chrome"

odlp avatar Mar 05 '22 14:03 odlp

I just ran into this as well +1

jconley88 avatar Mar 19 '22 03:03 jconley88

Merged manually. Thank you!

route avatar Nov 20 '22 09:11 route