On Sun, May 17, 2009 at 9:46 AM, Rick DeNatale <[email protected]> wrote:
> So I tried to make a spectask to run the specs after require in > activesupport by adding this in my rake file: > > desc "Run all specs with activesupport" > Spec::Rake::SpecTask.new(:spec_as) do |t| > t.spec_opts = ['--options', "spec/spec.opts"] > t.ruby_opts = ['-rrubygems', '-ractive_support'] > t.spec_files = FileList['spec/**/*_spec.rb'] > t.verbose = true > end > > Unfortunately, it seems that the ruby command only handles a single -r > option, the -rrubygems gets ignored and things fail because it can't > find active_support.rb, the same thing happens if I just try: > > $ruby -rrubygems -ractive_support -e'puts "Hello"' > > Right now the only approach I can think of is to somehow set an > environment variable which my spec helper would look at to determine > whether to require activesupport, but I don't even know if that's > possible with Kernel#system particularly in a platform independent > way. Follow up. I figured it out. The problem wasn't that Ruby doesn't allow multiple -r options, it was that the way it's done -rubygems -rsomegem won't work since -r doesn't use the same mechanism as require so that rubygems doesn't get involved. I fixed it by having an auxiliary .rb files which require rubygems and either activesupport or tzinfo and -r requiring that. -- Rick DeNatale Blog: http://talklikeaduck.denhaven2.com/ Twitter: http://twitter.com/RickDeNatale WWR: http://www.workingwithrails.com/person/9021-rick-denatale LinkedIn: http://www.linkedin.com/in/rickdenatale _______________________________________________ rspec-users mailing list [email protected] http://rubyforge.org/mailman/listinfo/rspec-users
