我正在尝试将我的一个Rails项目升级到
Ruby 1.9.2.一切都很好,但是一个RSpec测试破了.在这个测试中,我需要一个Ruby lib:
# file spec/models/my_lib_spec.rb require 'spec_helper' require 'lib/services/my_lib' describe "MyLib" do it "should do something" do ...
lib看起来像这样:
# file lib/services/my_lib.rb class MyLib def self.do_something ...
在Ruby 1.8.7(REE)中,测试运行良好:
$ruby -v ruby 1.8.7 (2011-02-18 patchlevel 334) [i686-darwin11.1.0],MBARI 0x6770,Ruby Enterprise Edition 2011.03 $rspec ./spec/models/my_lib_spec.rb .. Finished in 1.4 seconds 2 examples,0 failures
在Ruby 1.9.2中,我收到一个错误,没有这样的文件加载:
$ruby -v ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin11.1.0] $rspec ./spec/models/my_lib_spec.rb /Users/tmangner/.rvm/gems/ruby-1.9.2-p290@madgoal/gems/activesupport- 3.2.2/lib/active_support/dependencies.rb:251:in `require': no such file to load -- lib/services/my_lib (LoadError)
我没有线索,什么让Ruby 1.9找不到lib.