My Workpattern gem makes use of Travis CI and I have it configured to test on five different versions of ruby as can be seen in the .travis.yml file just below here.
Every version apart from Ruby 1.9.3 was passing their tests. That version was failing whilst bundler was running and provided the following error message:
This was the content of my .travis.yml file.
I didn’t understand what the problem was, but since I didn’t have that ruby version on my computer I went ahead and installed it using
rvm and created a gemset for it so I could specify exactly which gems were available. I installed the same version of bundler (1.7.6) used by Travis CI. Finally I ran
bundle install --jobs=3 ---retry=3 which is the command being ran when Travis CI failed and guess what? That’s right it completed successfully and then all my tests passed too.
I spent some of my early career working in support roles, and the one thing worst than a bug is not being able to reproduce a bug. It makes it kind of difficult to fix.
I decided to turn to my friend Duck Duck Go and entered a search where I found this was a very common problem that had something to do with the version of bundler being used. The general advice was to upgrade to the latest version of bundler, but I didn’t know how to do that in Travis CI.
The next search result was an issue against bundler and as I read through it I found a reference to a factory_girl commit from the good people at Thoughtbot that was a well written explanation and the work-around they used.
This was to update bundler befoe Travis CI installed the gems used for my gem. A
before_install: section containing
- gem update bundler was added to my
travis.yml file so it now looked like this:
This change resulted in my gem being built and passing all my tests on Travis CI. My only concern is I wasn’t able to reproduce the issue and so don’t full understand why it happened on Travis CI and not my own environment. I guess that is something I may learn another day.