[rspec-devel] require 'rubygems'

David Chelimsky dchelimsky at gmail.com
Wed Mar 25 21:31:06 EDT 2009


Hey all,

I'd like your feedback on something before I merge it into master.

Before the 1.2 release I read http://gist.github.com/54177, in which
Ryan Tomayko explains why "require 'rubygems'" should not appear in
your library code. This made some sense to me. So much so, that I
yanked it from rspec for the 1.2 release.

Then the bug reports started coming in and some conversation led me to
believe that this had been a mistake because it caused pain for the
lion's share of rspec users because most libraries go ahead and
require 'rubygems', so that has become the defacto standard situation,
for better or worse.

The solution that I added to 1.2.1 was to reinstate "require
'rubygems'" but with a catch:

  require 'rubygems' unless ENV['NO_RUBYGEMS']

This seemed like a fair tradeoff, since it allowed those who didn't
want to have to think about it to just use rspec as/is, and those who
do care and don't use rubygems in any given environment had an out.

I've just received another report about that decision, with a patch,
that offers what I think is a better solution:
https://rspec.lighthouseapp.com/projects/5645/tickets/763-rubygems-handling-once-more

I've pushed Tobias' patch to a require-rubygems branch for the moment.
I'm inclined to merge it into master, but this would the third release
in a row that makes changes to how rspec handles rubygems, and I want
it to be the last. So please let me know your thoughts, for or
against.

Thanks,
David


More information about the rspec-devel mailing list