黄瓜不使用rails 2.3.14&红宝石1.8.7 / ree

时间:2012-09-14 07:36:12

标签: ruby-on-rails ruby cucumber rake environment

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)
==================================================================================

这是我第一次尝试使用黄瓜,除了轨道投射视频的概念之外不知道它。由于我的系统尚未配置,因此我无法测试任何内容。

Expecting help - 
Thanks in advance
Sumanta

2 个答案:

答案 0 :(得分:1)

我解决了这个问题 - 起初我在enviorement / tests.rb中添加了宝石但是在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

从项目文件夹console / terminal运行此命令=>红宝石脚本/生成黄瓜

答案 1 :(得分:0)

我一眼就会说你有依赖问题。 Rails 2很老了,你试图安装的那些宝石已经远远超过了Rails 2的位置。

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

对遗留项目使用“> =”非常危险,因为Ruby宝石是快速移动的目标。 因此,对于每个遗留应用程序,有一天你必须锁定版本。