postmodern / gem_home

A tool for changing your $GEM_HOME
MIT License
118 stars 12 forks source link

Tests should not fail on existing GEM_HOME/GEM_PATH env variables #18

Open robfrawley opened 6 years ago

robfrawley commented 6 years ago

I changed the push/pop tests to account for the possibility that GEM_HOME and GEM_PATH may be set already in the environment where the tests are being run. Prior, the tests would fail when any values were assigned to the GEM_* variables.

A warning was also added for the unsupported state of having a random combination of the GEM_* variables set and unset: either they must both be assigned a value or neither should be assigned a value, otherwise the tests break. The addition of a large warning makes this clear.

Lastly, some additional test environments were added to ensure that everything functions as expected given the environment where no GEM_* variables are set, as well as the environment where they both are.

postmodern commented 3 years ago

I don't see the utility in running the tests with GEM_HOME/GEM_PATH set to something else. What we probably should do is unset GEM_HOME/GEM_PATH in test/helper.rb. Since the tests are 100% bash, they don't rely on any rubygems. We could also add tests to simulate when GEM_HOME/GEM_PATH is already set and whether gem_home_pop can properly restore them.