On Thu, 2012-08-02 at 12:24 +0200, Michal Fojtik wrote: > Hi, > > The problem is that 'require_relative' is actually a 'rubygem' too, > and so it require 'rubygems' to be required. > > If you put 'require "rubygems"' into spec_helper.rb, then 'spec_helper' > will need to be loaded by 'load' method to make it work. > > I'm more fun of adding "require 'rubygems'" into each test file, in that > case everything will work and we don't need to pollute RUBYOPT variable.
Yes, of course, you're right; so the standard test file header would be require 'rubygems' require 'require_relative' require_relative './common' and then chain up to some toplevel test boot file. > Another option is to execute single test file using: > > bundle exec ./tests/cimi/... > > Bundler will then take care of loading rubygems and everything runs smoothly. I'd prefer doing Bundler.setup in some toplevel test helper, but it would be preferrable to requiring env vars - though I'd much prefer the boilerplate above for each test file. David
