以下の内容はhttps://hyperneetprogrammer.hatenablog.com/entry/2016/07/07/204136より取得しました。


【備忘録】【Ruby on Rails】MiniTestにおいて、ActionView::Template::Error: couldn't find file... と出るときは

Ruby on Rails Tutorialの4th Editionが出たので、アプリを作っていったのですが

www.railstutorial.org

time_ago_in_wordsを使用している箇所を、rails_best_practicesのNot user time_ago_in_wordsに倣って、rails_timeagoというgemを使うことにしました。

github.com

そこまでは良かったのですが、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

これで完全な対処になっているかどうかわかりませんが、備忘録として・・・。

ちなみにRails5.0.0で、cloud9上で開発しました。




以上の内容はhttps://hyperneetprogrammer.hatenablog.com/entry/2016/07/07/204136より取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14