cuprite
cuprite copied to clipboard
Fix spec helper on MacOS
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"
I just ran into this as well +1
Merged manually. Thank you!