I just spent three days of my life banging my head against the wall trying to figure out why a simple 'rake' would not pass my spec file.
If this happens to you: Do not have a space in any folder path!. Seriously. In fact do not have a space in anything you name from here on out.
Here is my console output:
(in /Users/*****/Desktop/Learning Ruby/learn_ruby
)
$ rake
/Users/*******/Desktop/Learning Ruby/learn_ruby/00_hello/hello_spec.rb:116:
in `require': cannot load such file -- hello (LoadError)
The failure is caused by the line: require "hello"
This line tells Ruby that it needs to search the load path for a file named hello.rb
. However, when it looks at the load path, it can't find that file. You should either remove that line and define your code directly in the spec file, or create a hello.rb
file.
Newer versions of RSpec (2.11+ I believe) automatically add subdirectory lib
to the load path. Based on your Rakefile
it seems you are also loading the current lab directory and the subdirectory solution
.
I'm guessing you're expected to put your solution in solution/hello.rb
.
What worked for me was changing the require statement to a require_relative
I am using windows and an IDE
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With