Forum: Ruby RSpec and Cucumber

Cc7107cb48ea5e9d6b096f4c7fdf2bb1?d=identicon&s=25 Selvag Ruby (selvag1005)
on 2014-03-26 07:43
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:in
`require'
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:in
`load_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:in `block 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:in
`load_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:in
 `run!'
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
n `execute'
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:in `load'
C:/Ruby193/bin/cucumber:23:in `<main>'
Cc7107cb48ea5e9d6b096f4c7fdf2bb1?d=identicon&s=25 Selvag Ruby (selvag1005)
on 2014-03-26 07:54
Yes! I got green by pushed the .rb file into 'features' dir.
Cc7107cb48ea5e9d6b096f4c7fdf2bb1?d=identicon&s=25 Selvag Ruby (selvag1005)
on 2014-03-26 08:15
Selvag Ruby 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'.
5b972395a92333843018b4add8af0437?d=identicon&s=25 Damián M. González (igorjorobus)
on 2014-03-28 12:47
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.
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.