RSpec and Cucumber

As a learner of RSpec in “The RSpec Book”
When I run the cucumber command, I get loaderror as,

C:…\codebreaker\features>cucumber codebreaker_starts_game.feature

C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in
require': iconv will be deprecated in the future, use String#encode instead. cannot load such file -- codebreaker (LoadError) C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:inrequire’
C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in
require' C:/../codebreaker/features/support/env.rb:2:in<top (required)>’
C:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-.9.2/lib/cucumber/rb_support/rb_language.rb:143:in
load' C:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-.9.2/lib/cucumber/rb_support/rb_language.rb:143:inload_code_file’
C:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-.9.2/lib/cucumber/runtime/support_
code.rb:158:in load_file' C:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-.9.2/lib/cucumber/runtime/support_ code.rb:61:inblock in load_files!’
C:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-.9.2/lib/cucumber/runtime/support_code.rb:60:in
each' C:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-.9.2/lib/cucumber/runtime/support_code.rb:60:inload_files!’
C:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-.9.2/lib/cucumber/runtime.rb:185:i
n load_step_definitions' C:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-.9.2/lib/cucumber/runtime.rb:26:inrun!’
C:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-.9.2/lib/cucumber/cli/main.rb:54:i
n execute!' C:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-.9.2/lib/cucumber/cli/main.rb:29:i nexecute’
C:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-0.9.2/bin/cucumber:8:in
<top (requ ired)>' C:/Ruby193/bin/cucumber:23:inload’
C:/Ruby193/bin/cucumber:23:in `’

Yes! I got green by pushed the .rb file into ‘features’ dir.

Selvag R. wrote in post #1140994:

Yes! I got green by pushed the .rb files into ‘features’ dir.

Before that the Cucumber got run the feature, also finded the .rb file.
I stored env.rb inside subdir ‘support’ of dir ‘features’, so Cucumber
got env.rb file.

And then the env.rb had LOAD_PATH to game.rb in dir ‘codebreaker’, but
the game.rb file couldn’t load at run time.

Because the snippet in env.rb is,
$LOAD_PATH<<File.expand_path(’…/…/lib’, FILE)
require ‘codebreaker/game’

if you reading ‘The RSpec Book’ then you can see the above.

The game.rb existed at the out of the dir ‘feature’, so I want to do
either of the following,

  1. edit the path of the .rb file as,
    $LOAD_PATH<<File.expand_path(’…/…/…/lib’, FILE)

  2. relocated the needed .rb files into ‘feature’.

Hi. I suggest you two things. Read the entire RSpec and Cucumber books.
Take a look at this gem: https://github.com/IgorJorobus/cocot . Hope
this can help you.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs