This ensures correct RUBY_PATH is used when running `brew tests` with custom `HOMEBREW_RUBY_PATH` More info: https://github.com/Homebrew/brew/pull/6617#discussion_r336431131
and add tests