On Sat, May 16, 2009 at 11:57 AM, David Chelimsky <dchelim...@gmail.com> wrote: > On Fri, May 15, 2009 at 11:50 AM, Rick DeNatale <rick.denat...@gmail.com> > wrote: >> Ideally I'd like to >> have rake tasks like >> >> rake spec:tzinfo >> rake spec:activesupport >> rake spec:both >> >> The problem is that I think I need something like the fork option for >> spec task similar to the one in the cucumber task, since once loaded I >> can't unload one or the other gem in the same ruby process. >> >> Is there a trick I'm missing? > > Sounds like a missing feature, actually. RSpec's own suite has a > forker, which I'm pretty sure that Aslak wrote and is likely the > source of the cucumber option you're talking about, but it is not > exposed as an API, yet. I think it should be. Wanna patch it?
Well, I looked it, and it seems that the RSpec spectask does in fact run rspec in a separate process using the system command. 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. -- 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 rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users