0
My enviorenment: 
**Rails - 2.3.14
Ruby - ree/ruby 1.8.7** 

我第一次尝试使用黄瓜。对于我现有的项目,我关注了 => http://railscasts.com/episodes/155-beginning-with-cucumber 。

I have executed the **bold** commnads but it is giving the below mentioned error though I have rspec-core,rack-test & i18n latest version in my system: 

==============================================================================
**rvmsudo rake gems:unpack RAILS_ENV=test**
[sudo] password for ilfs: 

(in /home/ilfs/work/ces)
Please install RDoc 2.4.2+ to generate documentation.
DEPRECATION WARNING: Rake tasks in vendor/plugins/TBD_ prawnto/tasks, vendor/plugins/jrails/tasks, and vendor/plugins/online_help/tasks are deprecated. Use lib/tasks instead. (called from /home/ilfs/.rvm/gems/ree-1.8.7-2012.02@ces/gems/rails-2.3.14/lib/tasks/rails.rb:10)
gem install rspec --version ">= 1.2.2"
ERROR:  Error installing rspec:
    rspec requires rspec-core (~> 2.11.0)

gem install rspec-rails --version ">= 1.2.2"
ERROR:  Error installing rspec-rails:
    activesupport requires i18n (~> 0.6)

gem install webrat --version ">= 0.4.3"
ERROR:  Error installing webrat:
    webrat requires rack-test (>= 0.5.3)

rake aborted!
undefined method `version' for nil:NilClass

(See full trace by running task with --trace)

============================================================================

ilfs@ilfs:~/work/ces$ **rvmsudo rake gems:unpack:dependencies RAILS_ENV=test**
(in /home/ilfs/work/ces)

Please install RDoc 2.4.2+ to generate documentation.
DEPRECATION WARNING: Rake tasks in vendor/plugins/TBD_ prawnto/tasks, vendor/plugins/jrails/tasks, and vendor/plugins/online_help/tasks are deprecated. Use lib/tasks instead. (called from /home/ilfs/.rvm/gems/ree-1.8.7-2012.02@ces/gems/rails-2.3.14/lib/tasks/rails.rb:10)
gem install rspec --version ">= 1.2.2"
ERROR:  Error installing rspec:
    rspec requires rspec-core (~> 2.11.0)

gem install rspec-rails --version ">= 1.2.2"
ERROR:  Error installing rspec-rails:
    activesupport requires i18n (~> 0.6)

gem install webrat --version ">= 0.4.3"
ERROR:  Error installing webrat:
    webrat requires rack-test (>= 0.5.3)

rake aborted!
undefined method `version' for nil:NilClass

(See full trace by running task with --trace)
==================================================================================

这是我第一次尝试使用黄瓜,除了 rails cast video 的概念之外,我不知道它。由于我的系统尚未配置,所以我无法测试任何东西。

Expecting help - 
Thanks in advance
Sumanta
4

2 回答 2

1

我解决了这个问题——起初我在 enviorement/tests.rb 中添加了 gem,但是在 gemfile 中添加了这些 gem 之后——问题得到了解决。这是步骤-

在宝石文件中

group :development, :test do
  #gem "rspec-rails", '>=1.3.2'
  gem 'rspec', '>=1.3.2'
  gem "capybara", "0.3.9"
  gem "cucumber", ">=0.2.2"
  gem "cucumber-rails", "0.3.2" 
  gem 'database_cleaner'
  gem 'webrat', ">=0.4.3"
end

从项目文件夹控制台/终端运行此命令 => ruby​​ 脚本/生成黄瓜

于 2012-09-25T06:46:35.240 回答
0

乍一看,我会说你有依赖问题。Rails 2 已经很老了,您尝试安装的那些 gem 已经远远领先于 Rails 2 了。

所以我会避免在 Gem 要求中使用 ">=" 规范。由于您使用 Railscasts 作为学习工具,因此我会将 Gem 版本设为“=”。所以你至少可以保证版本是一样的。

将 ">=" 用于遗留项目是非常危险的,因为 Ruby gem 是快速移动的目标。因此,对于每个旧版应用程序,总有一天您必须锁定版本。

于 2012-09-14T09:36:35.257 回答