0
0

More than 1 year has passed since last update.

[Rails Minitest]'test' is already defined in Users::SessionsControllerTest (RuntimeError)

Posted at

イントロダクション

RailsMinitest中に発生したエラー。

`test': test_new_test is already defined in Users::SessionsControllerTest (RuntimeError)

エラー文のまま検索したら、検索結果が0件だったので共有しておく。

原因

このエラーは、同じテストファイル内で同一のテスト名が指定されている時に表示されるエラーである。

自分のファイルを見返してみると全く同じテスト名のものがあった。

test "new test" do
get new_user_session_path
assert_response :success
end


# ~~~


test "new test" do
get new_user_password_path(format: :json)
assert_response :success
end

なので、どちらか片方のテスト名を編集してやればテストはいつも通り動作する。

test "new test" do
get new_user_session_path
assert_response :success
end


# ~~~


test "passwords new test" do
get new_user_password_path(format: :json)
assert_response :success
end

以上。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0