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:
@@ -8,6 +8,7 @@ include Devise::TestHelpers
|
||||
@tournament.generateMatchups
|
||||
@school = @tournament.schools.first
|
||||
@wrestlers = @tournament.weights.first.wrestlers
|
||||
@adjust = Teampointadjust.find(1)
|
||||
end
|
||||
|
||||
def post_update
|
||||
@@ -324,4 +325,42 @@ include Devise::TestHelpers
|
||||
|
||||
|
||||
|
||||
|
||||
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
|
||||
|
||||
8
test/fixtures/teampointadjusts.yml
vendored
8
test/fixtures/teampointadjusts.yml
vendored
@@ -1,9 +1,7 @@
|
||||
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
||||
|
||||
one:
|
||||
id: 1
|
||||
points: 1
|
||||
wrestler_id: 1
|
||||
|
||||
two:
|
||||
points: 1
|
||||
wrestler_id: 1
|
||||
wrestler_id:
|
||||
school_id: 2
|
||||
|
||||
Reference in New Issue
Block a user