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

Team point adjustments controller tests

This commit is contained in:
2016-01-13 15:14:28 +00:00
parent c537c6067c
commit e502796863
2 changed files with 42 additions and 5 deletions

View File

@@ -8,6 +8,7 @@ include Devise::TestHelpers
@tournament.generateMatchups @tournament.generateMatchups
@school = @tournament.schools.first @school = @tournament.schools.first
@wrestlers = @tournament.weights.first.wrestlers @wrestlers = @tournament.weights.first.wrestlers
@adjust = Teampointadjust.find(1)
end end
def post_update def post_update
@@ -323,5 +324,43 @@ include Devise::TestHelpers
end end
test 'logged in tournament delegate can adjust team points' do
sign_in_delegate
get :teampointadjust, id: 1
success
end
test 'logged in tournament owner can adjust team points' do
sign_in_owner
get :teampointadjust, id: 1
success
end
test 'logged in tournament delegate cannot adjust team points' do
sign_in_school_delegate
get :teampointadjust, id: 1
redirect
end
test 'logged in tournament owner can delete team point adjust' do
sign_in_owner
post :remove_teampointadjust, id: 1, teampointadjust: Teampointadjust.find(1)
assert_redirected_to "/tournaments/#{@tournament.id}/teampointadjust"
end
test 'logged in tournament delegate can team point adjust' do
sign_in_delegate
post :remove_teampointadjust, id: 1, teampointadjust: Teampointadjust.find(1)
assert_redirected_to "/tournaments/#{@tournament.id}/teampointadjust"
end
test 'logged in school delegate cannot delete team point adjust' do
sign_in_school_delegate
post :remove_teampointadjust, id: 1, teampointadjust: Teampointadjust.find(1)
redirect
end
end end

View File

@@ -1,9 +1,7 @@
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
one: one:
id: 1
points: 1 points: 1
wrestler_id: 1 wrestler_id:
school_id: 2
two:
points: 1
wrestler_id: 1