mattbrictson / bundle_update_interactive

A stylish interactive mode for Bundler, inspired by `yarn upgrade-interactive`
MIT License
137 stars 3 forks source link

Add a true integration test that actually executes Bundler #41

Closed mattbrictson closed 3 weeks ago

mattbrictson commented 3 weeks ago

Before, our CLI tests were doing a significant amount of stubbing to avoid making external calls to Bundler commands. This limited the value of these tests. It also made them tedious to write, and required behind-the-scenes knowledge of when and how the lower-level code called out to Bundler.

In this PR, I refactored the existing CLI tests so that the stubbing is done at a higher level: at the Reporter API. This makes test setup easier while still allowing us to write tests to cover various CLI edge cases, like error handing.

For the primary, "happy path" case, I've created a CLIIntegrationTest. This runs the actual update-interactive executable via Open3.capture3, so every layer of the code base is exercised. Most importantly, Bundler commands themselves are actually executed.

The integration test confirms that when a gem is selected to be updated, the update really happens. It does this by inspecting the Gemfile.lock to see that the gem version was changed as expected.

I also updated the mocha configuration to make stubbing more strict going forward.