質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
Ruby

Rubyはプログラミング言語のひとつで、オープンソース、オブジェクト指向のプログラミング開発に対応しています。

RSpec

RSpecはRuby用のBDD(behaviour-driven development)フレームワークです。

Ruby on Rails

Ruby on Railsは、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

Ruby on Rails 4

Ruby on Rails4はRubyによって書かれたオープンソースのウェブフレームワークです。 Ruby on Railsは「設定より規約」の原則に従っており、効率的に作業を行うために再開発を行う必要をなくしてくれます。

Q&A

2回答

4025閲覧

Railsチュートリアルの第3章のRSpecの設定時にエラーが発生してしまう。

cluch

総合スコア8

Ruby

Rubyはプログラミング言語のひとつで、オープンソース、オブジェクト指向のプログラミング開発に対応しています。

RSpec

RSpecはRuby用のBDD(behaviour-driven development)フレームワークです。

Ruby on Rails

Ruby on Railsは、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

Ruby on Rails 4

Ruby on Rails4はRubyによって書かれたオープンソースのウェブフレームワークです。 Ruby on Railsは「設定より規約」の原則に従っており、効率的に作業を行うために再開発を行う必要をなくしてくれます。

0グッド

1クリップ

投稿2015/01/21 12:59

現在Railsチュートリアル(http://railstutorial.jp/)を使って学習をしているんですが、第3章のテストを実行しようとした際にエラーになってしまって困っています。

3.2.1テスト駆動開発の下記コマンドを実行すると、

lang

1$ bundle exec rspec spec/requests/static_pages_spec.rb

下記のエラーが出てしまいます。

lang

1/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) 2 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' 3 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' 4 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' 5 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)>' 6 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' 7 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' 8 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' 9 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' 10 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)>' 11 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' 12 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' 13 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' 14 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' 15 from /home/hiro/Documents/rails_projects/sample_app/spec/spec_helper.rb:4:in `<top (required)>' 16 from /home/hiro/Documents/rails_projects/sample_app/spec/requests/static_pages_spec.rb:1:in `require' 17 from /home/hiro/Documents/rails_projects/sample_app/spec/requests/static_pages_spec.rb:1:in `<top (required)>' 18 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' 19 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' 20 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' 21 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' 22 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' 23 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' 24 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' 25

RSpecを指定しているはずなのに、デフォルトのtest::unitが呼ばれてしまってるみたいで、どなたわかる方いらっしゃいますか?

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答2

0

Gemfileに

lang

1gem 'test-unit’

を追記すれば解決するかもしれません。
私も同じところでハマリました。

投稿2015/02/18 02:52

R.Imasaka

総合スコア13

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

0

Gemfileに'rspec-rails'は入っていますかね?
記述しただけでなく、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

投稿2015/01/29 15:54

kitaro_tn

総合スコア49

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだベストアンサーが選ばれていません

会員登録して回答してみよう

アカウントをお持ちの方は

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問