You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

48 lines
1.0 KiB

12 months ago
  1. require "test_helper"
  2. class ScoresControllerTest < ActionDispatch::IntegrationTest
  3. setup do
  4. @score = scores(:one)
  5. end
  6. test "should get index" do
  7. get scores_url
  8. assert_response :success
  9. end
  10. test "should get new" do
  11. get new_score_url
  12. assert_response :success
  13. end
  14. test "should create score" do
  15. assert_difference("Score.count") do
  16. post scores_url, params: { score: { grade: @score.grade, name: @score.name } }
  17. end
  18. assert_redirected_to score_url(Score.last)
  19. end
  20. test "should show score" do
  21. get score_url(@score)
  22. assert_response :success
  23. end
  24. test "should get edit" do
  25. get edit_score_url(@score)
  26. assert_response :success
  27. end
  28. test "should update score" do
  29. patch score_url(@score), params: { score: { grade: @score.grade, name: @score.name } }
  30. assert_redirected_to score_url(@score)
  31. end
  32. test "should destroy score" do
  33. assert_difference("Score.count", -1) do
  34. delete score_url(@score)
  35. end
  36. assert_redirected_to scores_url
  37. end
  38. end