Support gem execution with rbenv ruby.
Added testcases to suppor rbevn in gem.
Merge pull request #7942 from kretz/rbenv-support-in-gem

Support gem execution with rbenv ruby.