Fix read only git gems

See [3092](https://github.com/bundler/bundler/issues/3092)

The combined diff somewhat confuses the changes to `setup_spec.rb`. The individual commits are a bit easier to follow (added a spec, and refactored an existing spec to use a new helper method I added).