我正在尝试使用FakeFS,但在以下情况下不断收到未初始化的常量错误require 'fakefs'
:
C:/Ruby192/lib/ruby/gems/1.9.1/gems/fakefs-0.3.1/lib/fakefs/file.rb:26:in `<class:File>': uninitialized constant File::NOCTTY (NameError)
我最初在 RubyMine 中工作,但为了隔离问题,我编写了一个简单的 hello world 脚本并从命令行运行它,但仍然得到相同的错误。这是那个脚本:
require 'rubygems'
gem 'fakefs'
require 'fakefs'
puts "Hello Cleveland!"
这是错误和随附的堆栈跟踪:
>ruby foo.rb
C:/Ruby192/lib/ruby/gems/1.9.1/gems/fakefs-0.3.1/lib/fakefs/file.rb:26:in `<class:File>': uninitialized constant File::NOCTTY (NameError)
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/fakefs-0.3.1/lib/fakefs/file.rb:4:in `<module:FakeFS>'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/fakefs-0.3.1/lib/fakefs/file.rb:3:in `<top (required)>'
from <internal:lib/rubygems/custom_require>:29:in `require'
from <internal:lib/rubygems/custom_require>:29:in `require'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/fakefs-0.3.1/lib/fakefs/safe.rb:9:in `<top (required)>'
from <internal:lib/rubygems/custom_require>:29:in `require'
from <internal:lib/rubygems/custom_require>:29:in `require'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/fakefs-0.3.1/lib/fakefs.rb:1:in `<top (required)>'
from <internal:lib/rubygems/custom_require>:29:in `require'
from <internal:lib/rubygems/custom_require>:29:in `require'
from foo.rb:3:in `<main>'
我通过 RubyMine 安装了 fakefs gem。我正在使用 Ruby 1.9 在 Windows 上工作。有任何想法吗?