Railsチュートリアルの第3章のRSpecの設定時にエラーが発生してしまう。
受付中
回答 2
投稿
- 評価
- クリップ 1
- VIEW 3,228
3.2.1テスト駆動開発の下記コマンドを実行すると、
$ bundle exec rspec spec/requests/static_pages_spec.rb
下記のエラーが出てしまいます。
/home/hiro/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/activesupport-4.0.5/lib/active_support/dependencies.rb:229:in `require': cannot load such file -- test/unit/assertions (LoadError)
from /home/hiro/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/activesupport-4.0.5/lib/active_support/dependencies.rb:229:in `block in require'
from /home/hiro/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/activesupport-4.0.5/lib/active_support/dependencies.rb:214:in `load_dependency'
from /home/hiro/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/activesupport-4.0.5/lib/active_support/dependencies.rb:229:in `require'
from /home/hiro/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/rspec-rails-2.13.1/lib/rspec/rails/adapters.rb:3:in `<top (required)>'
from /home/hiro/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/activesupport-4.0.5/lib/active_support/dependencies.rb:229:in `require'
from /home/hiro/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/activesupport-4.0.5/lib/active_support/dependencies.rb:229:in `block in require'
from /home/hiro/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/activesupport-4.0.5/lib/active_support/dependencies.rb:214:in `load_dependency'
from /home/hiro/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/activesupport-4.0.5/lib/active_support/dependencies.rb:229:in `require'
from /home/hiro/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/rspec-rails-2.13.1/lib/rspec/rails.rb:11:in `<top (required)>'
from /home/hiro/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/activesupport-4.0.5/lib/active_support/dependencies.rb:229:in `require'
from /home/hiro/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/activesupport-4.0.5/lib/active_support/dependencies.rb:229:in `block in require'
from /home/hiro/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/activesupport-4.0.5/lib/active_support/dependencies.rb:214:in `load_dependency'
from /home/hiro/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/activesupport-4.0.5/lib/active_support/dependencies.rb:229:in `require'
from /home/hiro/Documents/rails_projects/sample_app/spec/spec_helper.rb:4:in `<top (required)>'
from /home/hiro/Documents/rails_projects/sample_app/spec/requests/static_pages_spec.rb:1:in `require'
from /home/hiro/Documents/rails_projects/sample_app/spec/requests/static_pages_spec.rb:1:in `<top (required)>'
from /home/hiro/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/rspec-core-2.13.1/lib/rspec/core/configuration.rb:819:in `load'
from /home/hiro/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/rspec-core-2.13.1/lib/rspec/core/configuration.rb:819:in `block in load_spec_files'
from /home/hiro/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/rspec-core-2.13.1/lib/rspec/core/configuration.rb:819:in `each'
from /home/hiro/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/rspec-core-2.13.1/lib/rspec/core/configuration.rb:819:in `load_spec_files'
from /home/hiro/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/rspec-core-2.13.1/lib/rspec/core/command_line.rb:22:in `run'
from /home/hiro/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/rspec-core-2.13.1/lib/rspec/core/runner.rb:80:in `run'
from /home/hiro/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/rspec-core-2.13.1/lib/rspec/core/runner.rb:17:in `block in autorun'
RSpecを指定しているはずなのに、デフォルトのtest::unitが呼ばれてしまってるみたいで、どなたわかる方いらっしゃいますか?
-
気になる質問をクリップする
クリップした質問は、後からいつでもマイページで確認できます。
またクリップした質問に回答があった際、通知やメールを受け取ることができます。
クリップを取り消します
-
良い質問の評価を上げる
以下のような質問は評価を上げましょう
- 質問内容が明確
- 自分も答えを知りたい
- 質問者以外のユーザにも役立つ
評価が高い質問は、TOPページの「注目」タブのフィードに表示されやすくなります。
質問の評価を上げたことを取り消します
-
評価を下げられる数の上限に達しました
評価を下げることができません
- 1日5回まで評価を下げられます
- 1日に1ユーザに対して2回まで評価を下げられます
質問の評価を下げる
teratailでは下記のような質問を「具体的に困っていることがない質問」、「サイトポリシーに違反する質問」と定義し、推奨していません。
- プログラミングに関係のない質問
- やってほしいことだけを記載した丸投げの質問
- 問題・課題が含まれていない質問
- 意図的に内容が抹消された質問
- 過去に投稿した質問と同じ内容の質問
- 広告と受け取られるような投稿
評価が下がると、TOPページの「アクティブ」「注目」タブのフィードに表示されにくくなります。
質問の評価を下げたことを取り消します
この機能は開放されていません
評価を下げる条件を満たしてません
質問の評価を下げる機能の利用条件
この機能を利用するためには、以下の事項を行う必要があります。
- 質問回答など一定の行動
-
メールアドレスの認証
メールアドレスの認証
-
質問評価に関するヘルプページの閲覧
質問評価に関するヘルプページの閲覧
+2
gem 'test-unit’
を追記すれば解決するかもしれません。
私も同じところでハマリました。
投稿
-
回答の評価を上げる
以下のような回答は評価を上げましょう
- 正しい回答
- わかりやすい回答
- ためになる回答
評価が高い回答ほどページの上位に表示されます。
-
回答の評価を下げる
下記のような回答は推奨されていません。
- 間違っている回答
- 質問の回答になっていない投稿
- スパムや攻撃的な表現を用いた投稿
評価を下げる際はその理由を明確に伝え、適切な回答に修正してもらいましょう。
0
記述しただけでなく、bundle install と rspecの設定は完了してますか
bundle install
rails generate rspec:install
正しくrspecが設定されていれば、taskにrspecが追加されていると思うので、確認してみてください。
bundle exec rake -vT
----
rake spec # Run all specs in spec directory (excluding plugin specs)
rake spec:controllers # Run the code examples in spec/controllers
rake spec:helpers # Run the code examples in spec/helpers
rake spec:lib # Run the code examples in spec/lib
rake spec:models # Run the code examples in spec/models
rake spec:requests # Run the code examples in spec/requests
rake spec:routing # Run the code examples in spec/routing
rake spec:views # Run the code examples in spec/views
投稿
-
回答の評価を上げる
以下のような回答は評価を上げましょう
- 正しい回答
- わかりやすい回答
- ためになる回答
評価が高い回答ほどページの上位に表示されます。
-
回答の評価を下げる
下記のような回答は推奨されていません。
- 間違っている回答
- 質問の回答になっていない投稿
- スパムや攻撃的な表現を用いた投稿
評価を下げる際はその理由を明確に伝え、適切な回答に修正してもらいましょう。
15分調べてもわからないことは、teratailで質問しよう!
- ただいまの回答率 88.23%
- 質問をまとめることで、思考を整理して素早く解決
- テンプレート機能で、簡単に質問をまとめられる