Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/60.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/xamarin/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails Cent OS 4.8和rails 2.3.4上的Rspec错误_Ruby On Rails_Rspec - Fatal编程技术网

Ruby on rails Cent OS 4.8和rails 2.3.4上的Rspec错误

Ruby on rails Cent OS 4.8和rails 2.3.4上的Rspec错误,ruby-on-rails,rspec,Ruby On Rails,Rspec,当我使用“spec xxx.rb”测试某些ruby代码时,我遇到了以下错误: Missing these required gems: webrat ~> 0.4.4 You're running: ruby 1.8.7.174 at /usr/local/bin/ruby rubygems 1.3.5 at /root/.gem/ruby/1.8, /usr/local/lib/ruby/gems/1.8 Run `rake gems:install` to insta

当我使用“spec xxx.rb”测试某些ruby代码时,我遇到了以下错误:

Missing these required gems:
  webrat  ~> 0.4.4

You're running:
  ruby 1.8.7.174 at /usr/local/bin/ruby
  rubygems 1.3.5 at /root/.gem/ruby/1.8, /usr/local/lib/ruby/gems/1.8

Run `rake gems:install` to install the missing gems.
我已经运行了webrat 0.5.3 gem。以下是我的服务器环境:

操作系统:CentOS 4.8 Ruby 1.8.7 i686 linux 轨道2.3.4

及创业板名单: *本地宝石*

actionmailer (2.3.4, 2.3.3, 2.2.2, 2.0.2)
actionpack (2.3.4, 2.3.3, 2.2.2, 2.0.2)
activerecord (2.3.4, 2.3.3, 2.2.2, 2.0.2)
activeresource (2.3.4, 2.3.3, 2.2.2, 2.0.2)
activesupport (2.3.4, 2.3.3, 2.2.2, 2.0.2)
builder (2.1.2)
cgi_multipart_eof_fix (2.5.0)
cucumber (0.3.104)
daemons (1.0.10)
diff-lcs (1.1.2)
fastthread (1.0.7)
gem_plugin (0.2.3)
git (1.2.3, 1.2.2)
mongrel (1.1.5)
mongrel_cluster (1.0.5)
nokogiri (1.3.3)
passenger (2.2.5)
polyglot (0.2.9)
rack (1.0.0)
radiant (0.8.1)
rails (2.3.4, 2.3.3, 2.2.2, 2.0.2)
rake (0.8.7, 0.8.4, 0.8.1)
RedCloth (4.2.2)
rmagick (2.11.1)
rspec (1.2.8)
rspec-rails (1.2.7.1)
sqlite3-ruby (1.2.5)
term-ansicolor (1.0.4)
treetop (1.4.2)
webrat (0.5.3)

有人知道发生了什么吗?

可能Webrat版本与您的rspec版本不兼容。请尝试按以下方式安装该特定版本:

sudo gem install webrat --version "=0.4.4"

老兄!!遇到同样的问题(幸运地解决了这个问题!)

您可能正在使用radiant,并且很可能您的config/environments/test.rb会说:

config.gem "webrat", :version => "~>0.4.4", :lib => false

删除
version=>“~>0.4.4”,
并开始工作。

我试过了,但还是同样的错误。我认为通过运行这个命令,使用中的webrat仍然是0.5.3。