1
0
mirror of https://github.com/jcwimer/wrestlingApp synced 2026-03-31 03:25:45 +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

@@ -36,6 +36,10 @@ class WeightsControllerTest < 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
@@ -50,6 +54,12 @@ class WeightsControllerTest < ActionController::TestCase
get_edit
success
end
test "logged in tournament delegate should get edit weight page" do
sign_in_tournament_delegate
get_edit
success
end
test "logged in user should not get edit weight page if not owner" do
sign_in_non_owner
@@ -78,6 +88,12 @@ class WeightsControllerTest < ActionController::TestCase
post_update
assert_redirected_to tournament_path(@weight.tournament_id)
end
test "logged in tournament delegate should post update weight" do
sign_in_tournament_delegate
post_update
assert_redirected_to tournament_path(@weight.tournament_id)
end
test "logged in tournament owner can create a new weight" do
sign_in_owner
@@ -86,6 +102,14 @@ class WeightsControllerTest < ActionController::TestCase
create
assert_redirected_to tournament_path(@weight.tournament_id)
end
test "logged in tournament delegate can create a new weight" do
sign_in_tournament_delegate
new
success
create
assert_redirected_to tournament_path(@weight.tournament_id)
end
test "logged in user not tournament owner cannot create a weight" do
sign_in_non_owner
@@ -100,6 +124,12 @@ class WeightsControllerTest < ActionController::TestCase
destroy
assert_redirected_to tournament_path(@tournament.id)
end
test "logged in tournament delegate can destroy a weight" do
sign_in_tournament_delegate
destroy
assert_redirected_to tournament_path(@tournament.id)
end
test "logged in user not tournament owner cannot destroy weight" do
sign_in_non_owner