thoughtbot / appraisal

A Ruby library for testing your library against different versions of dependencies.
https://thoughtbot.com
MIT License
1.25k stars 107 forks source link

Make tests more resilient in different git environments #215

Closed yevhenii-ponomarenko closed 5 months ago

yevhenii-ponomarenko commented 10 months ago

Summary

While working on this repository, a couple of issues sprung up on me that required me to modify my current git configuration to make sure that specs run properly:

  1. Bundler depends on the fact that gems generated for the purpose of a test have a master branch. If someone has an init.defaultBranch = main configuration in git, this will cause those temporary repositories with temporary gems to not have a master branch, failing a test.
  2. To create a proper repository, tests create an initial commit using git commit, which launches a pre-commit hook by default. If someone has a core.hooksPath variable set in their global git config, and if they have a global pre-commit hook, it will run on those repositories.

Since we're not testing how git works, and we're merely using it to create entities that we can use as stubs and dummies for testing, we don't need to trigger those features.

This PR edits dependency helpers to make it so that aforementioned local setup differences don't influence Appraisal testing.

nickcharlton commented 5 months ago

Thanks! I hit the default branch problem back when I was trying to work on setting up GitHub Actions and this is a nice way to fix that.