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

Added logic to delegate tournament access

This commit is contained in:
2016-01-06 18:38:02 +00:00
parent eb9037b078
commit f46029efaf
46 changed files with 417 additions and 121 deletions

View File

@@ -40,6 +40,10 @@ class MatsControllerTest < ActionController::TestCase
def sign_in_non_owner
sign_in users(:two)
end
def sign_in_tournament_delegate
sign_in users(:three)
end
def success
assert_response :success
@@ -62,6 +66,12 @@ class MatsControllerTest < ActionController::TestCase
get_edit
success
end
test "logged in tournament delegate should get edit mat page" do
sign_in_tournament_delegate
get_edit
success
end
test "logged in user should not get edit mat page if not owner" do
sign_in_non_owner
@@ -90,6 +100,12 @@ class MatsControllerTest < ActionController::TestCase
post_update
assert_redirected_to tournament_path(@mat.tournament_id)
end
test "logged in tournament delegate should post update mat" do
sign_in_tournament_delegate
post_update
assert_redirected_to tournament_path(@mat.tournament_id)
end
test "logged in tournament owner can create a new mat" do
sign_in_owner
@@ -98,6 +114,14 @@ class MatsControllerTest < ActionController::TestCase
create
assert_redirected_to tournament_path(@mat.tournament_id)
end
test "logged in tournament delegate can create a new mat" do
sign_in_tournament_delegate
new
success
create
assert_redirected_to tournament_path(@mat.tournament_id)
end
test "logged in user not tournament owner cannot create a mat" do
sign_in_non_owner
@@ -112,6 +136,12 @@ class MatsControllerTest < ActionController::TestCase
destroy
assert_redirected_to tournament_path(@tournament.id)
end
test "logged in tournament delegate can destroy a mat" do
sign_in_tournament_delegate
destroy
assert_redirected_to tournament_path(@tournament.id)
end
test "logged in user not tournament owner cannot destroy mat" do
sign_in_non_owner
@@ -130,6 +160,12 @@ class MatsControllerTest < ActionController::TestCase
show
success
end
test "logged in tournament delegate should get show mat" do
sign_in_tournament_delegate
show
success
end
#TESTS THAT NEED MATCHES PUT ABOVE THIS