What was the end-user or developer problem that led to this PR?
The developer problem is that sudo specs are not correctly setting the environment (except for ruby 2.3). The specs are accidentally passing but you can tell that they are running against the system ruby by the warning messages they print.
Another problem is that the environment is setup manually outside of rake spec:sudo, so there's no easy way of running sudo specs manually if your system does not have the right sudoers configuration.
What is your fix for the problem, implemented in this PR?
My fix is to properly set sudo configuration to preserve the environment so that the correct ruby can be found by sudo specs, and also to move the logic inside rake spec:sudo so that the specs can easily be run manually without side effects.
What was the end-user or developer problem that led to this PR?
The developer problem is that sudo specs are not correctly setting the environment (except for ruby 2.3). The specs are accidentally passing but you can tell that they are running against the system ruby by the warning messages they print.
This causes problems when migrating to github actions. See https://github.com/rubygems/bundler/pull/7660#discussion_r385616844.
Another problem is that the environment is setup manually outside of
rake spec:sudo
, so there's no easy way of running sudo specs manually if your system does not have the right sudoers configuration.What is your fix for the problem, implemented in this PR?
My fix is to properly set sudo configuration to preserve the environment so that the correct ruby can be found by sudo specs, and also to move the logic inside
rake spec:sudo
so that the specs can easily be run manually without side effects.