2

当放弃使用 rspec 和 rspec-rails 插件并改用 gem 版本时,我是否需要在 spec_helper.rb 中进行任何额外的更改,或者让我的应用程序中的规范看到更改?

删除插件并安装 gem (1.1.8) 后,我无法再让我的规范成功运行。

更具体地说,这就是我所做的:

  1. 从供应商目录中删除以前安装的 rspec 和 rspec-rails 插件
  2. sudo 安装了 rspec 和 rspec-rails gems(1.1.8 是撰写本文时的最新版本)

运行脚本/autospec 时,我收到以下消息:

/Library/Ruby/Site/1.8/rubygems.rb:578:in report_activate_error': RubyGem version error: hoe(1.5.0 not >= 1.7.0) (Gem::LoadError) from /Library/Ruby/Site/1.8/rubygems.rb:134:inactivate' from /Library/Ruby/Site/1.8/rubygems.rb:158:in activate' from /Library/Ruby/Site/1.8/rubygems.rb:157:ineach' from /Library/Ruby/Site/1.8/rubygems.rb :157:in activate' from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:inrequire' 来自 /Library/Ruby/Gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:509:in require' from /Library/Ruby/Gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:354:innew_constants_in' 来自 /Library/Ruby/Gems/1.8/gems/activesupport -2.1.0/lib/active_support/dependencies.rb:509:inrequire' from /Volumes/tangoflash/code/tangoflash/spec/spec_helper.rb:5 from spec/helpers/sessions_helper_spec.rb:1:in来自 spec/helpers/sessions_helper_spec.rb:1

尝试通过 textmate 运行单个 rspec 示例时,我得到:

/Library/Ruby/Site/1.8/rubygems.rb:578:in report_activate_error': RubyGem version error: hoe(1.5.0 not >= 1.7.0) (Gem::LoadError) from /Library/Ruby/Site/1.8/rubygems.rb:134:inactivate' from /Library/Ruby/Site/1.8/rubygems.rb:158:in activate' from /Library/Ruby/Site/1.8/rubygems.rb:157:ineach' from /Library/Ruby/Site/1.8/rubygems.rb :157:inactivate' from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in来自 /Users/allanlibunao/Library/Application Support/TextMate/Bundles/RSpec.tmbundle/Support/lib/spec/mate.rb:14 来自 /tmp/temp_textmate.KQTYKh:3:in `require'来自 /tmp/temp_textmate.KQTYKh:3

任何帮助都是极好的。

4

1 回答 1

3

从您的错误消息看来,您没有安装最新版本的hoegem。尝试做一个gem install hoe --version '> 1.7.0,看看它是否有帮助。可能是当您安装rspecrspec-railsgems 时,您也没有获得依赖项,并且可能缺少其他依赖项 gem。

于 2008-10-04T10:58:19.293 回答