From: Jim Freeze Date: 2003-07-09T22:30:34+09:00 Subject: Re: Integrations tests and $: On Wednesday, 9 July 2003 at 7:59:07 +0900, Brian Candler wrote: > On Wed, Jul 09, 2003 at 03:37:21AM +0900, Jim Freeze wrote: > > Now, I have moved on to integration testing > > and am testing ruby applications. The problem > > is that when I execute the system call > > to run the integration test, I lose the $:.unshift > > results. > > > > In other words > > > > $:.unshift("../lib") > > system("myapp") > > > > does not work since $: will not have "../lib". > > Solutions you can use: > > 1. Modify myapp so it knows where to find its libraries. e.g. it could contain > require '/etc/myconf' > where /etc/myconf.rb contains $:.unshift("/path/to/lib") Don't wont to have to modify the application before installation. > 2. set RUBYLIB so the child process knows where to look for its libraries > > ENV["RUBYLIB"]="../lib" > system("myapp") > I thought this would work, but I had a problem with path order. I can't remember exactly the problem right now though. > 3. since it's a Ruby program, you could run it in your existing Ruby > interpreter: > > $:.unshift("../lib") > load("myapp",true) I didn't think about that. I suppose I could open a fork and redirect the stdout and stderr so I can watch the output. -- Jim Freeze ---------- All science is either physics or stamp collecting. -- E. Rutherford