Under what circumstances would a Ruby $LOAD_PATH be acquired from a parent process?

Posted by Dr Nic on Stack Overflow See other posts from Stack Overflow or by Dr Nic
Published on 2011-02-06T06:30:25Z Indexed on 2011/02/06 7:26 UTC
Read the original article Hit count: 173

Filed under:
|
|

In my cucumber scenarios, if I call rake db:schema:load within a target Rails app folder, I get the cucumber process's $LOAD_PATH and not the Rails app's own Gemfile/load path. I think this is very weird.

The consequence is that I get the following error:

no such file to load -- rails/all

I can't reproduce it outside of my cucumber scenario.

ruby -rubygems -e "system 'rake -T'"

works normally -> the 'rake -T' has the application's own Gemfile-based $LOAD_PATH; and doesn't generate the error above.

Can anyone think why a child process (rake -T or rake db:schema:load or rails runner...; invoked by either system, exec, %x[...] or backtick; would start with the parent processes' $LOAD_PATH (from the cucumber scenario's Gemfile) instead of its own $LOAD_PATH (from the Rails app's Gemfile)?

© Stack Overflow or respective owner

Related posts about ruby

Related posts about rubygems