本番デプロイ設定: SSL, Kamal, API環境変数化, テスト修正

This commit is contained in:
2026-02-21 23:45:12 +09:00
parent e90ea88758
commit 9626db3dcf
21 changed files with 226 additions and 78 deletions

View File

@@ -2,7 +2,11 @@ require "test_helper"
class GamesControllerTest < ActionDispatch::IntegrationTest
setup do
@user = users(:one)
login_as(@user)
@game = games(:one)
# edit/update/destroy には管理者権限が必要
@game.participants.create!(user: @user, is_administrator: true) unless @game.participants.exists?(user: @user)
end
test "should get index" do
@@ -17,13 +21,22 @@ class GamesControllerTest < ActionDispatch::IntegrationTest
test "should create game" do
assert_difference("Game.count") do
post games_url, params: { game: { memo: @game.memo, participants_count: @game.participants_count, title: @game.title } }
post games_url, params: { game: {
title: "New Test Game",
memo: @game.memo,
participants_count: @game.participants_count,
victory_sc_count: 18,
scoring_system: "none"
} }
end
assert_redirected_to game_url(Game.last)
end
test "should show game" do
# showアクションではgame_stateが必要なため、ターンにgame_stateを設定
turn = @game.turns.first
turn.update(game_state: { "centers" => {}, "units" => {} }) if turn
get game_url(@game)
assert_response :success
end
@@ -34,7 +47,13 @@ class GamesControllerTest < ActionDispatch::IntegrationTest
end
test "should update game" do
patch game_url(@game), params: { game: { memo: @game.memo, participants_count: @game.participants_count, title: @game.title } }
patch game_url(@game), params: { game: {
title: @game.title,
memo: @game.memo,
auto_order_mode: @game.auto_order_mode,
victory_sc_count: 18,
scoring_system: "none"
} }
assert_redirected_to game_url(@game)
end