RuntimeError発生
Rails6で rails test
してみると下記のようなエラーが発生。
$ rails t
Running via Spring preloader in process 3232
Run options: --seed 48688
# Running:
/Users/amatsuki/programing/portfolio/study_roadmap/db/schema.rb doesn't exist yet. Run `rails db:migrate` to create it, then try again. If you do not intend to use a database, you should instead alter /Users/amatsuki/programing/portfolio/study_roadmap/config/application.rb to limit the frameworks that will be loaded.
/Users/amatsuki/programing/portfolio/study_roadmap/db/schema.rb doesn't exist yet. Run `rails db:migrate` to create it, then try again. If you do not intend to use a database, you should instead alter /Users/amatsuki/programing/portfolio/study_roadmap/config/application.rb to limit the frameworks that will be loaded.
Traceback (most recent call last):
5: from -e:1:in `<main>'
4: from /Users/amatsuki/.rbenv/versions/2.6.4/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
3: from /Users/amatsuki/.rbenv/versions/2.6.4/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
2: from /Users/amatsuki/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/minitest-5.11.3/lib/minitest.rb:63:in `block in autorun'
1: from /Users/amatsuki/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/minitest-5.11.3/lib/minitest.rb:140:in `run'
/Users/amatsuki/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/activesupport-6.0.0/lib/active_support/testing/parallelization.rb:118:in `shutdown': Queue not empty, but all workers have finished. This probably means that a worker crashed and 5 tests were missed. (RuntimeError)
対処法
下記コマンドで解決。
rails db:migrate
エラー文の上の方を見てみると、
schema.rb がないので rails db:migrate
して作ってねと書いてありました。
/Users/amatsuki/programing/portfolio/study_roadmap/db/schema.rb doesn't exist yet. Run `rails db:migrate` to create it, then try again. If you do not intend to use a database, you should instead alter /Users/amatsuki/programing/portfolio/study_roadmap/config/application.rb to limit the frameworks that will be loaded.