【備忘録】【Ruby on Rails】MiniTestにおいて、ActionView::Template::Error: couldn't find file... と出るときは
Ruby on Rails Tutorialの4th Editionが出たので、アプリを作っていったのですが
time_ago_in_words
を使用している箇所を、rails_best_practicesのNot user time_ago_in_wordsに倣って、rails_timeago
というgemを使うことにしました。
そこまでは良かったのですが、rails test
が以下のようなエラーを吐いて軒並み落ちてしまいました。
ActionView::Template::Error: ActionView::Template::Error: couldn't find file 'rails-timeago' with type 'application/javascript'
テストにおいてrails-timeago
を見つけられてないみたいでしたので、Gemfileをこのように修正しました。
- Before
group :development do . . gem 'rails-timeago', '~> 2.0' end
- After
group :development, :test do . . gem 'rails-timeago', '~> 2.0' end
つまり:development
groupから:development, :test
groupに移してあげた、という基本中の基本みたいな話です・・・。
それでも落ちる場合はspring
をいったん切ってみる、など
$ ps aux | grep spring $ kill -9 PID
これで完全な対処になっているかどうかわかりませんが、備忘録として・・・。
ちなみにRails
は5.0.0
で、cloud9上で開発しました。