【问题标题】:Help with Ruby on Rails Gem file and bundle install帮助 Ruby on Rails Gem 文件和捆绑安装
【发布时间】:2011-05-03 02:09:30
【问题描述】:

我正在尝试向http://ruby.railstutorial.org/学习rails

练习 3 解释如何使用这个 gemfile 安装 rspec、rspec-rails 和 webrat

source 'http://rubygems.org'

gem 'rails', '3.0.6'


gem 'sqlite3', '1.3.3', :require => 'sqlite3'

group :development do
    gem "rspec-rails", ">= 2.0.1"
end

group :test do
    gem "rspec-rails", ">= 2.0.1"
    gem 'rpsec'
    gem 'webrat'
end

我已尝试安装 rspec-rails 和 webrat,它们似乎已正确安装。

C:\RubyProject\sample_app>gem install rspec-rails -v=2.0.1
**************************************************

  Thank you for installing rspec-rails-2.0.1!

  This version of rspec-rails only works with versions of rails >= 3.0.0

  To configure your app to use rspec-rails, add a declaration to your Gemfile.
  If you are using Bundler's grouping feature in your Gemfile, be sure to include
  rspec-rails in the :development group as well as the :test group so that you
  can access its generators and rake tasks.

    group :development, :test do
      gem "rspec-rails", ">= 2.0.1"
    end

  Be sure to run the following command in each of your Rails apps if you're
  upgrading:

    script/rails generate rspec:install

  Even if you've run it before, this ensures that you have the latest updates
  to spec/spec_helper.rb and any other support files.

  Beta versions of rspec-rails-2 installed files that are no longer being used,
  so please remove these files if you have them:

    lib/tasks/rspec.rake
    config/initializers/rspec_generator.rb

  Lastly, be sure to look at Upgrade.markdown to see what might have changed
  since the last release.

**************************************************
Successfully installed rspec-rails-2.0.1
1 gem installed
Installing ri documentation for rspec-rails-2.0.1...
Installing RDoc documentation for rspec-rails-2.0.1...

但是当我运行 bundle install

我收到以下错误消息

Could not find gem 'rpec-rails (= 2.0.1)' in any of the gem sources listed in your Gemfile.

所以我作为 RoR 的新手完全不知道为什么会发生这种情况。我试过点击这个链接

http://railsforum.com/viewtopic.php?id=41464

这似乎是一个死胡同。我希望这里有人能指出我正确的方向。任何帮助将不胜感激。

【问题讨论】:

  • 你能给出bundle list的输出吗?

标签: ruby-on-rails rubygems bundle-install


【解决方案1】:

如果你的输出是正确的:

在您的 Gemfile 中列出的任何 gem 源中都找不到 gem 'rpec-rails (= 2.0.1)'

然后看起来您的 gem 文件中有错字。您已经安装了 gem,但由于您没有正确拼写 rspec-rails,它不会与应用程序捆绑在一起。检查 gem 文件中的声明。

这个词拼起来很烦人。

【讨论】:

  • 非常感谢。考虑到我的帖子的长度,我有点尴尬,这是一个错字,而不是任何技术性的东西。
【解决方案2】:

我注意到您的 :test 组包含一个错字:rpsec 而不是 rspec

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-04-11
    • 1970-01-01
    • 2014-12-24
    相关资源
    最近更新 更多