You Need Some Isolation
Posted by matijs 11/12/2011 at 18h08
Something weird just happened. While refactoring GirFFI, I had managed to remove all use of a particular module. So, I removed the corresponding file, ran the tests using
And the tests passed. Committed, done.
Then, I took a walk down to the library. By the time I got back, as soon as I looked at my code again, there it was: A giant require statement requiring the file I had just removed. Huh, why do my tests pass?
Well, duh, I have GirFFI installed as a gem, and my code is just picking up the missing file from there. So, I run
bundle exec rake test
The tests fail, showing me exactly the line I need to remove. Commit amended, done.
So, the moral of the story: If you’re developing a gem, use your isolation tool of choice, be it Bundler, Isolate, or something else, to shield your gem development environment from older installed versions.