How to get Rails.root in gem code

Hi all,

While coding a gem for Rails 3.x app stress testing, I faced a problem
when
I’m trying to load the test files.

Those files are located in “#{Rails.root}/test/performance/stress”
directory.

My gem provides a command in MY_GEM_PATH/bin/my_gem_name which loads and
execute those test files (from the Rails app directory).

How could the gem find the Rails.root path (and generally Rails
environment) ?

Can someone help me find a common pattern for doing this ?

PS: I already looked at some gems code on github, among with capistrano,
thin. But everyone seems to have his own recipe, and it’s not really
evident.

Thanks