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

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

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

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

Ruby on Rails

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

Q&A

1回答

1099閲覧

MinitestでのUnexceptedErrorの原因を突き止めたい

Gl_ImasL

総合スコア18

Ruby

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

Ruby on Rails

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

0グッド

0クリップ

投稿2020/02/10 03:38

前提・実現したいこと

Ruby on Railsにてコントローラのテストを行った際に表示された下記のエラーメッセージを解除したいです。

発生している問題・エラーメッセージ

usernoMacBook-Pro:test user$ rake test test/controllers/articles_controller_test.rb (in /Users/user/Documents/Atom/Ruby on Rails/asagao) Run options: --seed 57752 # Running: ..............Traceback (most recent call last): 11: from /Users/user/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/minitest-5.14.0/lib/minitest.rb:68:in `block in a utorun' 10: from /Users/user/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/minitest-5.14.0/lib/minitest.rb:138:in `run' 9: from /Users/user/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/activesupport-6.0.2.1/lib/active_support/testing/ parallelization.rb:74:in `start' 8: from /Users/user/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/activesupport-6.0.2.1/lib/active_support/testing/ parallelization.rb:74:in `map' 7: from /Users/user/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/activesupport-6.0.2.1/lib/active_support/testing/ parallelization.rb:74:in `each' 6: from /Users/user/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/activesupport-6.0.2.1/lib/active_support/testing/ parallelization.rb:74:in `times' 5: from /Users/user/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/activesupport-6.0.2.1/lib/active_support/testing/ parallelization.rb:75:in `block in start' 4: from /Users/user/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/activesupport-6.0.2.1/lib/active_support/testing/ parallelization.rb:75:in `fork' 3: from /Users/user/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/activesupport-6.0.2.1/lib/active_support/testing/ parallelization.rb:94:in `block (2 levels) in start' 2: from /Users/user/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/activesupport-6.0.2.1/lib/active_support/testing/ parallelization.rb:97:in `rescue in block (2 levels) in start' 1: from /Users/user/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/activesupport-6.0.2.1/lib/active_support/testing/ parallelization.rb:97:in `each' /Users/user/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/activesupport-6.0.2.1/lib/active_support/testing/parallelization.r b:98:in `block (3 levels) in start': undefined method `exception=' for #<Minitest::UnexpectedError: Unexpected exception> (NoMethodErro r) Did you mean? exception Traceback (most recent call last): 2: from /Users/user/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/minitest-5.14.0/lib/minitest.rb:68:in `block in au torun' 1: from /Users/user/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/minitest-5.14.0/lib/minitest.rb:145:in `run' /Users/user/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/activesupport-6.0.2.1/lib/active_support/testing/parallelization.r b:118:in `shutdown': Queue not empty, but all workers have finished. This probably means that a worker crashed and 1 tests were missed. (RuntimeError)

該当のソースコード

以下のテストを走らせました。

Ruby

1require 'test_helper' 2 3class ArticlesControllerTest < ActionController::TestCase 4 test "index" do 5 5.times { FactoryGirl.create(:article) } 6 get :index 7 assert_response :success 8 assert_equal 5, assigns(:articles).count 9 end 10 11 test "show" do 12 article = FactoryGirl.create(:article, expired_at: nil) 13 get :show, params: { id: article.id } 14 assert_response :success 15 end 16 17 test "new" do 18 get :new 19 assert_response :success 20 end 21 22 test "edit" do 23 article = FactoryGirl.create(:article) 24 get :edit, params: { id: article.id } 25 assert_response :success 26 end 27 28 test "create" do 29 post :create, params: { article: FactoryGirl.attributes_for(:article) } 30 article = Article.order(:id).last 31 assert_redirected_to article 32 end 33 34 test "update" do 35 article = FactoryGirl.create(:article) 36 patch :update, params: { id: article.id, article: FactoryGirl.attributes_for(:article) } 37 assert_redirected_to article 38 end 39 40 test "fail to create" do 41 attrs = FactoryGirl.attributes_for(:article, title: "") 42 post :create, params: { article: attrs } 43 assert_response :success 44 assert_template "new" 45 end 46 47 test "fail to update" do 48 attrs = FactoryGirl.attributes_for(:article, body: "") 49 article = FactoryGirl.create(:article) 50 put :update, params: { id: article.id, article: attrs } 51 assert_response :success 52 assert_template "edit" 53 end 54end 55

試したこと

こちらに書かれたことは試しましたが、エラーメッセージは変わらぬままでした。

補足情報(FW/ツールのバージョンなど)

Rails 6.0.2.1
Ruby 2.5.0
Minitest (5.14.0, 5.10.3)

articlesのDBの定義は以下です。

db

1class CreateArticles < ActiveRecord::Migration[6.0] 2 def change 3 create_table :articles do |t| 4 t.string :title, null: false #タイトル 5 t.text :body, null: false #本文 6 t.datetime :released_at, null: false #掲載開始日時 7 t.datetime :expired_at #掲載終了日時 8 t.boolean :member_only, null: false, default: false #会員のみフラグ 9 t.timestamps null: false 10 end 11 end 12end

皆さまからの質問などは分からないなりに調べてご返信致します。何か不足した情報などがありましたら教えて頂ければと思います。何卒宜しくお願い致します。

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

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

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

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

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

guest

回答1

0

Railsはやったことがないので、間違っているかもですが。
minitest のバージョンが新しすぎるのではないでしょうか?

以下の active support の変更を見る限り、

https://github.com/rails/rails/commit/268a099b1b8ad6aa58e52a100d4201f253663feb

activesupport 6.0.2.1 は minitest 5.14 は未対応みたいです。

投稿2020/02/10 07:45

編集2020/02/10 07:46
taichi730

総合スコア318

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

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

Gl_ImasL

2020/02/12 03:53

返信が遅くなってしまい、大変申し訳ありませんでした。railsでプロジェクトを作るとminitestが自動で入ってくるのですが、可能であれば別のバージョンのminitestをインストール出来ないか試してみます。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

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

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

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

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

ただいまの回答率
85.47%

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

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

質問する

関連した質問