Are there module existing for system test

I have looked around a little at rubyforge and RAA.
I would like to have something like unit tests also for system tests.
What I
have in mind is, that I have a ruby-wrapper starting the programs “under
test” (e.g. Makefiles (but the whole system is running in unix with
commands (not rake|rant)). I would like to check to somehow “monitor”
is going on in the unix shell. This implies:

  1. The wrapper should fake the system command or at least provide a
    possibility to switch to “own” commands (could be done maybe by
    the PATH-Variable)
  2. Track which commands are started inside the shell.

Is there hook to see which commands are executed inside a shell?
I think about using pty,Open3 or shell maybe.
With respect to that I have another question. When I start a process in
Open3.popen3 . How can I determine the working directory in that