[rspec-users] File not found

Justin Ko jko170 at gmail.com
Thu Jun 21 19:03:25 UTC 2012

On Jun 21, 2012, at 11:12 AM, n/a n/a wrote:

> I've been trying to learn RSpec using the book The RSpec Book by David
> Chelimsky but I've been having a problem in Chapter 5 around page 50. I
> tried running "rspec spec/codebreaker/game_spec.rb --format doc" but it
> said that codebreaker could not be found.
> The file spec/codebreaker/game_spec.rb requires spec/spec_helper and
> spec_helper requires spec/codebreaker. In fact, the whole contents of
> spec/spec_helper.rb is "require 'codebreaker'". However,
> spec/codebreaker is a directory not a file and I wonder if this is
> causing the problem. It seems to me that "require 'codebreaker'" would
> look for spec/codebreaker.rb, but I can't find anywhere where the book
> says to define a file called spec/codebreaker.rb.
> Does anyone know what the problem might be? Can "require 'codebreaker'"
> make sense if codebreaker is a directory but there is no codebreaker.rb
> file?

No. `require` is for requiring files. If Ruby cannot find the file, it will raise an error.

Can you push your code to Github so we can take a look?

> -- 
> Posted via http://www.ruby-forum.com/.
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users

More information about the rspec-users mailing list