2011-02-08 6 views
0

...문제 명령을 내 testfile 위의 test_a에 쓰기 단순히 그러나 나는 또 다시이 이상한 메시지를 받고 오전 testfile 위와 같은 폴더에 존재하는 파일을 필요로하고

<internal:lib/rubygems/custom_require>:29:in `require': no such file to load -- a.rb (LoadError) 
     from <internal:lib/rubygems/custom_require>:29:in `require' 
     from C:/dummyFirefox/test_a.rb:1:in `<top (required)>' 
     from C:/Ruby192/lib/ruby/gems/1.9.1/gems/rspec-core-2.5.1/lib/rspec/core/configuration.rb:386:in `load' 
     from C:/Ruby192/lib/ruby/gems/1.9.1/gems/rspec-core-2.5.1/lib/rspec/core/configuration.rb:386:in `block in load_spec_files' 
     from C:/Ruby192/lib/ruby/gems/1.9.1/gems/rspec-core-2.5.1/lib/rspec/core/configuration.rb:386:in `map' 
     from C:/Ruby192/lib/ruby/gems/1.9.1/gems/rspec-core-2.5.1/lib/rspec/core/configuration.rb:386:in `load_spec_files' 
     from C:/Ruby192/lib/ruby/gems/1.9.1/gems/rspec-core-2.5.1/lib/rspec/core/command_line.rb:18:in `run' 
     from C:/Ruby192/lib/ruby/gems/1.9.1/gems/rspec-core-2.5.1/lib/rspec/core/runner.rb:55:in `run_in_process' 
     from C:/Ruby192/lib/ruby/gems/1.9.1/gems/rspec-core-2.5.1/lib/rspec/core/runner.rb:46:in `run' 
     from C:/Ruby192/lib/ruby/gems/1.9.1/gems/rspec-core-2.5.1/lib/rspec/core/runner.rb:10:in `block in autorun' 

코드를 필요로 사용 .rb는 단순히 :

require 'a.rb' 

을 내가 명령을 실행할 때 : rspec test_a.rb를 메시지는 위에서 언급 한 오류입니다.

개발을 위해 ruby-1.9.2를 사용하고 있습니다.

희망 사항 세부 사항을 놓치지 마세요. 미리 감사드립니다.

+0

가능한 중복 ] (http://stackoverflow.com/questions/4491049/calling-another-ruby-file-that-is-not-a-gem) – Nakilon

+0

참고 : http://stackoverflow.com/questions/2900370/why- do-ruby-1-9-2-load-path-and-whats-the-alternative에서 제거하십시오. – Nakilon

답변

3

Ruby 1.9.2에서 현재 작업 디렉토리는 더 이상로드 경로 ($LOAD_PATH 또는 $:)의 일부가 아닙니다. 다음을 사용하여 수동으로 추가해야합니다 :

$LOAD_PATH.unshift '.' 

또는

$:.unshift '.' 

을 또는 당신은 명시 적으로 파일을 필요로 할 수 있습니다 [이 보석 아닌 다른 루비 파일을 호출의

require './test_a.rb' 
+0

네 .. 솔루션이 작동 .. 도움을 주셔서 감사합니다 ... –