small medium large xlarge

Back to: All Forums  The RSpec Book
Generic-user-small
21 Dec 2010, 12:01
George L. Githinji (5 posts)

Ruby 1.9.2 Mac OSX 10.6.5

cucumber (0.10.0, 0.9.4, 0.8.5) cucumber-rails (0.3.2)

rspec (2.3.0, 2.2.0, 2.1.0, 2.0.1) rspec-core (2.3.1, 2.2.1, 2.1.0, 2.0.1) rspec-expectations (2.3.0, 2.2.0, 2.1.0, 2.0.1) rspec-mocks (2.3.0, 2.2.0, 2.1.0, 2.0.1) rspec-rails (2.3.1, 2.2.1, 2.1.0, 2.0.1)

Getting an error

rspec spec/codebreaker/game_spec.rb –format doc <internal:lib/rubygems/custom_require>:29:in require': no such file to load -- codebreaker/game (LoadError) from <internal:lib/rubygems/custom_require>:29:in require’ from /Users/georgegithinji/Scripts/ruby_scripts/codebreaker/lib/codebreaker.rb:1:in <top (required)>' from <internal:lib/rubygems/custom_require>:29:in require’ from <internal:lib/rubygems/custom_require>:29:in require' from /Users/georgegithinji/Scripts/ruby_scripts/codebreaker/spec/spec_helper.rb:1:in <top (required)>’ from <internal:lib/rubygems/custom_require>:29:in require' from <internal:lib/rubygems/custom_require>:29:in require’ from /Users/georgegithinji/Scripts/ruby_scripts/codebreaker/spec/codebreaker/game_spec.rb:1:in <top (required)>' from /Users/georgegithinji/.rvm/gems/ruby-1.9.2-p0/gems/rspec-core-2.3.1/lib/rspec/core/configuration.rb:388:in load’ from /Users/georgegithinji/.rvm/gems/ruby-1.9.2-p0/gems/rspec-core-2.3.1/lib/rspec/core/configuration.rb:388:in block in load_spec_files' from /Users/georgegithinji/.rvm/gems/ruby-1.9.2-p0/gems/rspec-core-2.3.1/lib/rspec/core/configuration.rb:388:in map’ from /Users/georgegithinji/.rvm/gems/ruby-1.9.2-p0/gems/rspec-core-2.3.1/lib/rspec/core/configuration.rb:388:in load_spec_files' from /Users/georgegithinji/.rvm/gems/ruby-1.9.2-p0/gems/rspec-core-2.3.1/lib/rspec/core/command_line.rb:18:in run’ from /Users/georgegithinji/.rvm/gems/ruby-1.9.2-p0/gems/rspec-core-2.3.1/lib/rspec/core/runner.rb:55:in run_in_process' from /Users/georgegithinji/.rvm/gems/ruby-1.9.2-p0/gems/rspec-core-2.3.1/lib/rspec/core/runner.rb:46:in run’ from /Users/georgegithinji/.rvm/gems/ruby-1.9.2-p0/gems/rspec-core-2.3.1/lib/rspec/core/runner.rb:10:in `block in autorun’

Dchelimsky_pragsmall
21 Dec 2010, 13:07
David Chelimsky (203 posts)

Please post the code in lib/codebreaker.rb?

Generic-user-small
21 Dec 2010, 13:56
George L. Githinji (5 posts)

It seems that typing require ‘game’

seems to work instead of what is specified in the book(page 59)

Dchelimsky_pragsmall
21 Dec 2010, 18:58
David Chelimsky (203 posts)

What’s in the book works. There is probably something else going on.

What directory are you in when you type the command?

Generic-user-small
22 Feb 2012, 17:41
Russell Baker (1 post)

The ‘confusing’ part is the directory structure. You do need one codebreaker project root but some of the subfolders include other codebreaker subfolders. Refer to the code download and look at the structure in the cb folder which would be (codebreaker) the root folder in the project. I was a little confused by this too.

Getting dirty doing tf racing's inventory_pragsmall
25 Sep 2013, 00:57
Ray Dipasupil (3 posts)

I, too, am having the same problem.

Here’s the code from ~~~ lib/codebreaker.rb ~~~ :

$LOAD_PATH « File.expand_path(‘../../../lib’, FILE) require ‘codebreaker/game’

The error is: cannot load such file – codebreaker/game (LoadError) /usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:51:in require' /usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:51:in require’ /Users/raydipasupil/codebreaker/features/support/env.rb:2:in <top (required)>' /usr/local/rvm/gems/ruby-2.0.0-p247/gems/cucumber-1.3.8/lib/cucumber/rb_support/rb_language.rb:122:in load’ /usr/local/rvm/gems/ruby-2.0.0-p247/gems/cucumber-1.3.8/lib/cucumber/rb_support/rb_language.rb:122:in load_code_file' /usr/local/rvm/gems/ruby-2.0.0-p247/gems/cucumber-1.3.8/lib/cucumber/runtime/support_code.rb:180:in load_file’ /usr/local/rvm/gems/ruby-2.0.0-p247/gems/cucumber-1.3.8/lib/cucumber/runtime/support_code.rb:83:in block in load_files!' /usr/local/rvm/gems/ruby-2.0.0-p247/gems/cucumber-1.3.8/lib/cucumber/runtime/support_code.rb:82:in each’ /usr/local/rvm/gems/ruby-2.0.0-p247/gems/cucumber-1.3.8/lib/cucumber/runtime/support_code.rb:82:in load_files!' /usr/local/rvm/gems/ruby-2.0.0-p247/gems/cucumber-1.3.8/lib/cucumber/runtime.rb:183:in load_step_definitions’ /usr/local/rvm/gems/ruby-2.0.0-p247/gems/cucumber-1.3.8/lib/cucumber/runtime.rb:42:in run!' /usr/local/rvm/gems/ruby-2.0.0-p247/gems/cucumber-1.3.8/lib/cucumber/cli/main.rb:47:in execute!’ /usr/local/rvm/gems/ruby-2.0.0-p247/gems/cucumber-1.3.8/bin/cucumber:13:in <top (required)>' /usr/local/rvm/gems/ruby-2.0.0-p247/bin/cucumber:23:in load’ /usr/local/rvm/gems/ruby-2.0.0-p247/bin/cucumber:23:in <main>' /usr/local/rvm/gems/ruby-2.0.0-p247/bin/ruby_noexec_wrapper:14:in eval’ /usr/local/rvm/gems/ruby-2.0.0-p247/bin/ruby_noexec_wrapper:14:in `'

I’m on Ruby 2.0.0 and Rails 4.0. Everything on the RSpec has worked thus far except this (p. 59).

Thank you in advance. Huge fan of the RSpec book already.

Getting dirty doing tf racing's inventory_pragsmall
25 Sep 2013, 01:54
Ray Dipasupil (3 posts)

Nevermind! It looks like after saving, closing, and reopening the directory solved my problem! It’s just odd how that works… ?

(Moving forward to Ch. 5 now. Very excited.)

Harrison-cannon_pragsmall
02 Jan 2014, 18:22
harrison cannon (3 posts)

I too struggled with the same thing. I did not have a ‘codebreaker’ folder inside my lib directory. When I changed the code in codebreaker.rb to require ‘game’ it worked fine. Or make sure you have created another folder inside lib called codebreaker and put the game.rb file there. Love the book BTW. I am a Rails newb coming from a .NET world.

  You must be logged in to comment