mirror of
https://github.com/jcwimer/wrestlingApp
synced 2026-03-25 01:14:43 +00:00
Cleaned up tests
This commit is contained in:
@@ -4,15 +4,11 @@ class PoolAdvancementTest < ActionDispatch::IntegrationTest
|
|||||||
|
|
||||||
def setup
|
def setup
|
||||||
tournament = Tournament.find(1)
|
tournament = Tournament.find(1)
|
||||||
|
|
||||||
|
# WHY DOES THIS NOT WORK WITHOUT GENERATING MATCHUPS BEFORE EVERY TEST?
|
||||||
|
# FIXTURES FOR MATCHES ARE FILLED OUT AND WORK FOR OTHER TESTS
|
||||||
tournament.generateMatchups
|
tournament.generateMatchups
|
||||||
end
|
end
|
||||||
|
|
||||||
# def showMatches
|
|
||||||
# matches = Weight.where("id = ?", 4).first.matches
|
|
||||||
# matches.each do |m|
|
|
||||||
# puts "Bout: #{m.bout_number} #{m.w1_name} vs #{m.w2_name} #{m.bracket_position} #{m.poolNumber}"
|
|
||||||
# end
|
|
||||||
# end
|
|
||||||
|
|
||||||
def singlePoolNotFinished
|
def singlePoolNotFinished
|
||||||
|
|
||||||
@@ -234,8 +230,7 @@ class PoolAdvancementTest < ActionDispatch::IntegrationTest
|
|||||||
end
|
end
|
||||||
|
|
||||||
def endMatch(bout,winner)
|
def endMatch(bout,winner)
|
||||||
match = Match.where(bout_number: bout).first
|
match = Match.where(bout_number: bout).first
|
||||||
# match = @matches.select{|m| m.bout_number == bout}.first
|
|
||||||
match.win_type = "Decision"
|
match.win_type = "Decision"
|
||||||
match.score = 1-0
|
match.score = 1-0
|
||||||
saveMatch(match,winner)
|
saveMatch(match,winner)
|
||||||
@@ -286,7 +281,9 @@ class PoolAdvancementTest < ActionDispatch::IntegrationTest
|
|||||||
def saveMatch(match,winner)
|
def saveMatch(match,winner)
|
||||||
match.finished = 1
|
match.finished = 1
|
||||||
match.winner_id = translateNameToId(winner)
|
match.winner_id = translateNameToId(winner)
|
||||||
match.save
|
|
||||||
|
match.save!
|
||||||
|
# match.after_update_actions
|
||||||
end
|
end
|
||||||
|
|
||||||
def translateNameToId(wrestler)
|
def translateNameToId(wrestler)
|
||||||
@@ -541,15 +538,15 @@ class PoolAdvancementTest < ActionDispatch::IntegrationTest
|
|||||||
end
|
end
|
||||||
|
|
||||||
test "Test mat assignment when adding a mat and when destroying a mat" do
|
test "Test mat assignment when adding a mat and when destroying a mat" do
|
||||||
@mat2 = Mat.new
|
mat2 = Mat.new
|
||||||
@mat2.name = "2"
|
mat2.name = "2"
|
||||||
@mat2.tournament_id = 1
|
mat2.tournament_id = 1
|
||||||
@mat2.save
|
mat2.save
|
||||||
assert_equal 4, @mat2.matches.size
|
assert_equal 4, mat2.matches.size
|
||||||
elevenManBracketFinished
|
elevenManBracketFinished
|
||||||
@mat2.destroy
|
mat2.destroy
|
||||||
@mat1 = Mat.find(1)
|
mat1 = Mat.find(1)
|
||||||
assert_equal 4, @mat1.matches.size
|
assert_equal 4, mat1.matches.size
|
||||||
end
|
end
|
||||||
|
|
||||||
test "Championship bracket wins are 2pts" do
|
test "Championship bracket wins are 2pts" do
|
||||||
|
|||||||
@@ -4,13 +4,10 @@ class SingleTestTest < ActionDispatch::IntegrationTest
|
|||||||
def setup
|
def setup
|
||||||
@tournament = Tournament.find(1)
|
@tournament = Tournament.find(1)
|
||||||
# @tournament.generateMatchups
|
# @tournament.generateMatchups
|
||||||
# @matches = @tournament.matches
|
|
||||||
end
|
end
|
||||||
|
|
||||||
#rake test test/integration/single_test_test.rb > matches.txt
|
#rake test test/integration/single_test_test.rb > matches.txt
|
||||||
# Loser names need to be in quotes in yml file
|
|
||||||
def showMatches
|
def showMatches
|
||||||
# matches = Weight.where("id = ?", 4).first.matches
|
|
||||||
count = 1
|
count = 1
|
||||||
|
|
||||||
# Yml for matches
|
# Yml for matches
|
||||||
|
|||||||
Reference in New Issue
Block a user