I have this small project I've been working on. In this project, I've been using the rspec to test the classes, so my project folder is structured like this:
.
+--lib
| +-- # bunch of classes
|
+--spec
| +-- # bunch of tests
Being in the project root, if I run rspec
all the tests are ran correctly.
However, if I run the main script through the command line, like this: ruby lib/main.rb
, then I get this error:
`require': cannot load such file
If I change all the requires to ./lib/class_name
it works, but the rspec
stops working.
What is the right way to do this?