1
0
mirror of https://github.com/jcwimer/wrestlingApp synced 2026-03-25 01:14:43 +00:00

Fixed redirect for match editing and added controller tests. Added wrestler school name to match edit form. Added authorization tests to all matches page.

This commit is contained in:
2019-01-23 19:22:55 +00:00
parent bb8ec92bf0
commit b001445090
9 changed files with 52 additions and 21 deletions

View File

@@ -12,6 +12,11 @@ class MatchesControllerTest < ActionController::TestCase
def post_update
patch :update, params: { id: @match.id, match: {tournament_id: 1, mat_id: 1} }
end
def post_update_from_match_edit
get :edit, params: { id: @match.id }
patch :update, params: { id: @match.id, match: {tournament_id: 1, mat_id: 1} }
end
def get_edit
get :edit, params: { id: @match.id }
@@ -94,7 +99,12 @@ class MatchesControllerTest < ActionController::TestCase
test "logged in tournament delegate should post update match" do
sign_in_tournament_delegate
post_update
assert_redirected_to mat_path(1)
assert_redirected_to tournament_path(@tournament.id)
end
test "should redirect to all matches when posting a match update from match edit" do
sign_in_owner
post_update_from_match_edit
assert_redirected_to "/tournaments/#{@tournament.id}/matches"
end
end