简体   繁体   English

黄瓜不适用于Rails 2.3.14和ruby 1.8.7 / ree

[英]Cucumber is not working with rails 2.3.14 & ruby 1.8.7/ree

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

I am trying to use cucumber for the first time. 我正在尝试第一次使用黄瓜。 I followed => http://railscasts.com/episodes/155-beginning-with-cucumber for my existing project. 我遵循了=> 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)
==================================================================================

This is first time I am trying to use cucumber, have no idea about it except rails cast video's concept. 这是我第一次尝试使用黄瓜,除了rails cast video的概念外,我对此一无所知。 As I my system does not yet configured so I am not able to test anything. 由于我的系统尚未配置,因此我无法进行任何测试。

Expecting help - 
Thanks in advance
Sumanta

I solved this issue - at first I was adding gems in enviorement/tests.rb but after adding those gems in gemfile - problem get solved. 我解决了这个问题-最初我在enviorement / tests.rb中添加了gems,但是在gemfile中添加了gems之后-问题得到解决。 this is the step- 这是步骤-

in gemfile 在gemfile中

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

from project folder console/terminal run this command => ruby script/generate cucumber 从项目文件夹控制台/终端运行此命令=> ruby​​脚本/生成黄瓜

At a glance I would say that your are having dependency issues. 乍一看,我想说您遇到依赖问题。 Rails 2 is pretty old, and those gems you are trying to install have moved quite far ahead of where Rails 2 is. Rails 2已经很老了,您尝试安装的那些宝石已经远远超出了Rails 2的位置。

So I would avoid using the ">=" specification in the Gem requirement. 因此,我将避免在Gem要求中使用“> =”规范。 Since you're using a Railscasts as a learning tool, I would make the Gem versions "=". 由于您将Railscasts用作学习工具,因此我将Gem版本设为“ =“。 So you can at least guarantee that the versions are the same. 因此,您至少可以保证版本相同。

Using ">=" for legacy project is pretty dangerous as Ruby gems are fast moving targets. 对旧项目使用“> =”非常危险,因为Ruby宝石是快速移动的目标。 So for every legacy app, there comes a day when you have to lock versions. 因此,对于每个旧版应用程序,都有一天您必须锁定版本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM