mirror of
https://github.com/jcwimer/wrestlingApp
synced 2026-03-25 01:14:43 +00:00
Added tests for assign_next_match mat action permissions
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
Wrestling::Application.routes.draw do
|
Wrestling::Application.routes.draw do
|
||||||
resources :mats
|
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
|
resources :matches
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ class MatsControllerTest < ActionController::TestCase
|
|||||||
end
|
end
|
||||||
|
|
||||||
def post_assign_next_match
|
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
|
end
|
||||||
|
|
||||||
def new
|
def new
|
||||||
@@ -233,13 +233,13 @@ class MatsControllerTest < ActionController::TestCase
|
|||||||
test "logged in tournament owner should post assign_next_match mat page" do
|
test "logged in tournament owner should post assign_next_match mat page" do
|
||||||
sign_in_owner
|
sign_in_owner
|
||||||
post_assign_next_match
|
post_assign_next_match
|
||||||
success
|
assert_redirected_to "/tournaments/#{@mat.tournament_id}"
|
||||||
end
|
end
|
||||||
|
|
||||||
test "logged in tournament delegate should post assign_next_match mat page" do
|
test "logged in tournament delegate should post assign_next_match mat page" do
|
||||||
sign_in_tournament_delegate
|
sign_in_tournament_delegate
|
||||||
post_assign_next_match
|
post_assign_next_match
|
||||||
success
|
assert_redirected_to "/tournaments/#{@mat.tournament_id}"
|
||||||
end
|
end
|
||||||
|
|
||||||
test "logged in user should not get post assign_next_match page if not owner" do
|
test "logged in user should not get post assign_next_match page if not owner" do
|
||||||
|
|||||||
Reference in New Issue
Block a user