I got this 'require' cannot load such file error.
I got this previously and I added
__LIB_DIR__ = File.expand_path(File.join(File.dirname(__FILE__), ".."))
unless $LOAD_PATH.include?(__LIB_DIR__)
$LOAD_PATH.unshift(__LIB_DIR__)
end
I would like to know what this does? I added this in a main 'require' file of my project. Now I write a test case,
$:.unshift File.join(File.dirname(__FILE__), ".")
I try to run it, I get the LoadError. I also tried require_relative
no luck.
Structure:
Main
Git
lib
files.rb
base.rb
test
test1.rb
I have the first code block above in base.rb where I do all 'requires' and when i try to run the test. I get LoadError.
'Please',Explain the first and second code blocks also give me a solution