From bde2b6d8c49bbe3fa4a44655ead8b95177211ab4 Mon Sep 17 00:00:00 2001 From: Jacob Cody Wimer Date: Mon, 9 Jan 2023 19:55:19 -0500 Subject: [PATCH] Added tests for assign_next_match mat action permissions --- config/routes.rb | 2 +- test/controllers/mats_controller_test.rb | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/config/routes.rb b/config/routes.rb index 0fb79c9..aeaa149 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,6 +1,6 @@ Wrestling::Application.routes.draw do resources :mats - post "mats/:id/assign_next_match" => "mats#assign_next_match" + post "mats/:id/assign_next_match" => "mats#assign_next_match", :as => :assign_next_match resources :matches diff --git a/test/controllers/mats_controller_test.rb b/test/controllers/mats_controller_test.rb index 90cac53..9b77f05 100644 --- a/test/controllers/mats_controller_test.rb +++ b/test/controllers/mats_controller_test.rb @@ -15,7 +15,7 @@ class MatsControllerTest < ActionController::TestCase end def post_assign_next_match - post :assign_next_match, params: { mat: {name: 'Mat100', tournament_id; 1} } + post :assign_next_match, params: { id: @mat.id } end def new @@ -233,13 +233,13 @@ class MatsControllerTest < ActionController::TestCase test "logged in tournament owner should post assign_next_match mat page" do sign_in_owner post_assign_next_match - success + assert_redirected_to "/tournaments/#{@mat.tournament_id}" end test "logged in tournament delegate should post assign_next_match mat page" do sign_in_tournament_delegate post_assign_next_match - success + assert_redirected_to "/tournaments/#{@mat.tournament_id}" end test "logged in user should not get post assign_next_match page if not owner" do