0

私はhttp://ruby.railstutorial.org/からレールを学ぼうとしています

演習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...

しかし、バンドルインストールを実行すると

次のエラーメッセージが表示されます

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

これは行き止まりのようです。ここの誰かが私を正しい方向に向けてくれることを願っています。どんな助けでもいただければ幸いです。

4

2 に答える 2

1

あなたの:testグループにはタイプミスが含まれていることに気付きました:rpsecの代わりにrspec.

于 2011-05-03T02:16:33.667 に答える
1

出力が正しい場合:

Gemfileにリストされている gem ソースのいずれにもgem 'rpec-rails (= 2.0.1)'が見つかりませんでした。

次に、gem ファイルにタイプミスがあるようです。gem をインストールしましたが、 rspec-rails のスペルが正しくなかったため、アプリにバンドルされません。gem ファイルの宣言を確認してください。

綴るのがむずかしい言葉です。

于 2011-05-03T02:17:07.583 に答える