sportdb-models 1.18.6 → 1.19.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (114) hide show
  1. checksums.yaml +4 -4
  2. data/Manifest.txt +0 -106
  3. data/Rakefile +0 -1
  4. data/lib/sportdb/deleter.rb +1 -1
  5. data/lib/sportdb/models.rb +3 -88
  6. data/lib/sportdb/version.rb +2 -2
  7. data/test/helper.rb +0 -108
  8. metadata +2 -122
  9. data/lib/sportdb/indexers/team.rb +0 -87
  10. data/lib/sportdb/matcher.rb +0 -31
  11. data/lib/sportdb/pretty_printer.rb +0 -175
  12. data/lib/sportdb/reader.rb +0 -132
  13. data/lib/sportdb/reader_file.rb +0 -131
  14. data/lib/sportdb/reader_zip.rb +0 -172
  15. data/lib/sportdb/readers/assoc.rb +0 -54
  16. data/lib/sportdb/readers/event.rb +0 -253
  17. data/lib/sportdb/readers/event_meta.rb +0 -133
  18. data/lib/sportdb/readers/event_table.rb +0 -196
  19. data/lib/sportdb/readers/game.rb +0 -912
  20. data/lib/sportdb/readers/ground.rb +0 -53
  21. data/lib/sportdb/readers/league.rb +0 -54
  22. data/lib/sportdb/readers/season.rb +0 -83
  23. data/lib/sportdb/readers/squad_club.rb +0 -201
  24. data/lib/sportdb/readers/squad_national_team.rb +0 -173
  25. data/lib/sportdb/readers/team.rb +0 -53
  26. data/lib/sportdb/rsssf_reader.rb +0 -367
  27. data/lib/sportdb/utils.rb +0 -89
  28. data/lib/sportdb/utils_date.rb +0 -26
  29. data/lib/sportdb/utils_goals.rb +0 -20
  30. data/lib/sportdb/utils_group.rb +0 -63
  31. data/lib/sportdb/utils_map.rb +0 -44
  32. data/lib/sportdb/utils_round.rb +0 -165
  33. data/lib/sportdb/utils_scores.rb +0 -17
  34. data/lib/sportdb/utils_teams.rb +0 -48
  35. data/test/data/at-austria/2013_14/bl.txt +0 -227
  36. data/test/data/at-austria/2013_14/bl.yml +0 -30
  37. data/test/data/at-austria/2013_14/bl_ii.txt +0 -154
  38. data/test/data/at-austria/2013_14/el.txt +0 -4
  39. data/test/data/at-austria/2013_14/el.yml +0 -25
  40. data/test/data/at-austria/2013_14/squads/austria.txt +0 -40
  41. data/test/data/at-austria/2013_14/squads/salzburg.txt +0 -35
  42. data/test/data/at-austria/2014_15/1-bundesliga-ii.txt +0 -158
  43. data/test/data/at-austria/2014_15/1-bundesliga.yml +0 -18
  44. data/test/data/at-austria/2015_16/1-bundesliga-v2.conf.txt +0 -20
  45. data/test/data/at-austria/2015_16/1-bundesliga-v2.yml +0 -20
  46. data/test/data/at-austria/2015_16/1-bundesliga.conf.txt +0 -20
  47. data/test/data/at-austria/2015_16/1-bundesliga.yml +0 -24
  48. data/test/data/at-austria/2015_16/cup.yml +0 -77
  49. data/test/data/at-austria/leagues.txt +0 -11
  50. data/test/data/at-austria/teams.txt +0 -68
  51. data/test/data/at-austria/teams_2.txt +0 -21
  52. data/test/data/csv/de-2013-14--1-bundesliga.txt +0 -307
  53. data/test/data/de-deutschland/2013-14/1-bundesliga.yml +0 -26
  54. data/test/data/de-deutschland/leagues.txt +0 -4
  55. data/test/data/de-deutschland/teams.txt +0 -53
  56. data/test/data/eng-england/2015-16/1-premierleague-v2.yml +0 -2
  57. data/test/data/eng-england/2015-16/1-premierleague.yml +0 -5
  58. data/test/data/national-teams/assocs.txt +0 -231
  59. data/test/data/national-teams/europe/assocs.txt +0 -13
  60. data/test/data/national-teams/europe/teams.txt +0 -13
  61. data/test/data/national-teams/north-america/assocs.txt +0 -10
  62. data/test/data/national-teams/north-america/teams.txt +0 -7
  63. data/test/data/national-teams/teams.txt +0 -19
  64. data/test/data/players/europe/at-austria/players.txt +0 -45
  65. data/test/data/players/europe/de-deutschland/players.txt +0 -41
  66. data/test/data/players/south-america/br-brazil/players.txt +0 -51
  67. data/test/data/rsssf/at-2014-15--1-bundesliga.txt +0 -339
  68. data/test/data/rsssf/at-2015-16--1-bundesliga.txt +0 -18
  69. data/test/data/world-cup/1930/cup.txt +0 -71
  70. data/test/data/world-cup/1930/cup.yml +0 -23
  71. data/test/data/world-cup/1930/cup_goals.txt +0 -47
  72. data/test/data/world-cup/1930/cup_goals.yml +0 -23
  73. data/test/data/world-cup/1954/cup.txt +0 -90
  74. data/test/data/world-cup/1954/cup.yml +0 -30
  75. data/test/data/world-cup/1962/cup.txt +0 -86
  76. data/test/data/world-cup/1962/cup.yml +0 -32
  77. data/test/data/world-cup/1974/cup.yml +0 -35
  78. data/test/data/world-cup/1974/cup_finals.txt +0 -14
  79. data/test/data/world-cup/1974/cup_i.txt +0 -55
  80. data/test/data/world-cup/1974/cup_ii.txt +0 -34
  81. data/test/data/world-cup/2014/cup.txt +0 -5
  82. data/test/data/world-cup/2014/cup.yml +0 -54
  83. data/test/data/world-cup/2014/squads/br-brazil.txt +0 -46
  84. data/test/data/world-cup/2014/squads/de-deutschland.txt +0 -8
  85. data/test/data/world-cup/2014/squads/jp-japan.txt +0 -30
  86. data/test/data/world-cup/2014/squads/uy-uruguay.txt +0 -32
  87. data/test/data/world-cup/leagues.txt +0 -5
  88. data/test/data/world-cup/seasons_1930.txt +0 -4
  89. data/test/data/world-cup/seasons_1954.txt +0 -4
  90. data/test/data/world-cup/seasons_1962.txt +0 -4
  91. data/test/data/world-cup/seasons_1974.txt +0 -5
  92. data/test/data/world-cup/teams_1930.txt +0 -26
  93. data/test/data/world-cup/teams_1954.txt +0 -30
  94. data/test/data/world-cup/teams_1962.txt +0 -29
  95. data/test/data/world-cup/teams_1974.txt +0 -29
  96. data/test/test_assoc_reader.rb +0 -199
  97. data/test/test_event_meta_reader.rb +0 -47
  98. data/test/test_event_reader.rb +0 -64
  99. data/test/test_event_table_reader.rb +0 -57
  100. data/test/test_goals.rb +0 -107
  101. data/test/test_indexer_team.rb +0 -34
  102. data/test/test_load.rb +0 -61
  103. data/test/test_pp.rb +0 -35
  104. data/test/test_reader.rb +0 -88
  105. data/test/test_reader_from_string.rb +0 -63
  106. data/test/test_round_auto.rb +0 -370
  107. data/test/test_round_def.rb +0 -109
  108. data/test/test_round_header.rb +0 -183
  109. data/test/test_rsssf_reader.rb +0 -76
  110. data/test/test_squad_club_reader.rb +0 -76
  111. data/test/test_squad_national_team_reader.rb +0 -116
  112. data/test/test_standings.rb +0 -279
  113. data/test/test_standings_ii.rb +0 -46
  114. data/test/test_utils.rb +0 -124
@@ -1,34 +0,0 @@
1
- ##################################################
2
- # World Cup 1974 West Germany, 13 June - 7 July
3
-
4
-
5
- #### Second Round
6
- ## todo/fix: add stage/add stage key to rounds
7
- #
8
- # Group A -> I
9
- # Group B -> J - fix: use Group A,B etc.
10
-
11
- Group I | Netherlands Brazil East Germany Argentina
12
- Group J | West Germany Poland Sweden Yugoslavia
13
-
14
- Group I:
15
-
16
- (25) 26 June Brazil 1-0 East Germany @ Niedersachsenstadion, Hanover
17
- (26) 26 June Netherlands 4-0 Argentina @ Parkstadion, Gelsenkirchen
18
-
19
- (29) 30 June East Germany 0-2 Netherlands @ Parkstadion, Gelsenkirchen
20
- (30) 30 June Argentina 1-2 Brazil @ Niedersachsenstadion, Hanover
21
-
22
- (33) 3 July Argentina 1-1 East Germany @ Parkstadion, Gelsenkirchen
23
- (34) 3 July Netherlands 2-0 Brazil @ Westfalenstadion, Dortmund
24
-
25
- Group J:
26
-
27
- (27) 26 June Yugoslavia 0-2 West Germany @ Rheinstadion, Düsseldorf
28
- (28) 26 June Sweden 0-1 Poland @ Neckarstadion, Stuttgart
29
-
30
- (31) 30 June West Germany 4-2 Sweden @ Rheinstadion, Düsseldorf
31
- (32) 30 June Poland 2-1 Yugoslavia @ Waldstadion, Frankfurt
32
-
33
- (35) 3 July Poland 0-1 West Germany @ Waldstadion, Frankfurt
34
- (36) 3 July Sweden 2-1 Yugoslavia @ Rheinstadion, Düsseldorf
@@ -1,5 +0,0 @@
1
- ############################
2
- # World Cup 2014 Brazil
3
-
4
- # note: empty just for testing squads
5
-
@@ -1,54 +0,0 @@
1
- ##################################
2
- # World Cup 2014 Brazil
3
-
4
- league: world
5
- season: 2014
6
- start_at: 2014-06-12
7
-
8
-
9
- ######
10
- # 32 Teams
11
- #
12
- # Europe (UEFA): 13 places
13
- # Africa (CAF): 5 places
14
- # Asia (AFC): 4 places
15
- # South America (CONMEBOL) 5 places (+ Brazil qualified automatically as host nation for a total of 5 or 6 places)
16
- # North, Central American and Caribbean (CONCACAF): 4 places
17
- # Oceania (OFC): 0
18
- #
19
- # see en.wikipedia.org/wiki/2014_FIFA_World_Cup_qualification
20
-
21
- # teams:
22
- #- nga # Nigeria -- Africa (5)
23
- #- civ # Côte d'Ivoire
24
- #- cmr # Cameroon
25
- #- gha # Ghana
26
- #- alg # Algeria
27
- #- aus # Australia -- Asia (4) includes Australia
28
- #- irn # Iran
29
- #- jpn # Japan
30
- #- kor # South Korea
31
- #- crc # Costa Rica -- North, Central American and Caribbean (4)
32
- #- usa # United States
33
- #- hon # Honduras
34
- #- mex # Mexico
35
- #- bra # Brazil -- South America (5+1)
36
- #- arg # Argentina
37
- #- col # Colombia
38
- #- chi # Chile
39
- #- ecu # Ecuador
40
- #- uru # Uruguay
41
- #- bel # Belgium -- Europe (13)
42
- #- ger # Germany
43
- #- ita # Italy
44
- #- ned # Netherlands
45
- #- sui # Switzerland
46
- #- bih # Bosnia and Herzegovina
47
- #- rus # Russia
48
- #- esp # Spain
49
- #- eng # England
50
- #- gre # Greece
51
- #- cro # Croatia
52
- #- por # Portugal
53
- #- fra # France
54
-
@@ -1,46 +0,0 @@
1
- ##############################
2
- # Brazil - World Cup 2014
3
- #
4
- # Coaching Staff
5
- # - Head Coach: Luiz Felipe Scolari
6
-
7
-
8
- ####################
9
- # GK / Goal Keepers
10
-
11
- Jefferson ## Botafogo
12
- Julio César ## Toronto F.C
13
- Victor ## Atlético-MG
14
-
15
- ####################
16
- # DF / Defenders
17
-
18
- Dante (Bayern de Munique)
19
- David Luiz (Chelsea)
20
- Henrique (Napoli)
21
- Thiago Silva (Paris Saint-Germain)
22
- Daniel Alves (Barcelona)
23
- Maicon (Roma)
24
- Marcelo (Real Madrid)
25
- Maxwell (PSG)
26
-
27
- ####################
28
- # MF / Midfielders
29
-
30
- Fernandinho (Manchester City)
31
- Hernanes (Inter de Milão)
32
- Luiz Gustavo (Wolfsburg)
33
- Oscar (Chelsea)
34
- Paulinho (Tottenham)
35
- Ramires (Chelsea)
36
- Willian (Chelsea)
37
-
38
- ####################
39
- # FW / Forwards
40
-
41
- Bernard (Shakhtar)
42
- Fred (Fluminense)
43
- Hulk (Zenit)
44
- Jô (Atlético-MG)
45
- Neymar (Barcelona)
46
-
@@ -1,8 +0,0 @@
1
- #################################
2
- # Deutschland - World Cup 2014
3
-
4
-
5
- Mesut Özil
6
- Thomas Müller
7
- Bastian Schweinsteiger
8
-
@@ -1,30 +0,0 @@
1
- #######
2
- # note: players NOT in players database; will get auto-created for testing
3
- #
4
-
5
- (1) GK Eiji Kawashima ## 56, Standard Liège (BEL)
6
- (12) GK Shusaku Nishikawa ## 12, Urawa Red Diamonds (JPN)
7
- (23) GK Shūichi Gonda ## 2, F.C. Tokyo (JPN)
8
-
9
- (2) DF Atsuto Uchida ## 67, Schalke 04 (GER)
10
- (3) DF Gōtoku Sakai ## 12, VfB Stuttgart (GER)
11
- (5) DF Yuto Nagatomo ## 69, Internazionale (ITA)
12
- (6) DF Masato Morishige ## 9, F.C. Tokyo (JPN)
13
- (15) DF Yasuyuki Konno ## 80, Gamba Osaka (JPN)
14
- (19) DF Masahiko Inoha ## 21, Jubilo Iwata (JPN)
15
- (21) DF Hiroki Sakai ## 17, Hannover 96 (GER)
16
- (22) DF Maya Yoshida ## 40, Southampton (ENG)
17
-
18
- (4) MF Keisuke Honda ## 55, Milan (ITA)
19
- (7) MF Yasuhito Endō ## 143, Gamba Osaka (JPN)
20
- (8) MF Hiroshi Kiyotake ## 25, 1. FC Nürnberg (GER)
21
- (10) MF Shinji Kagawa ## 56, Manchester United (ENG)
22
- (14) MF Toshihiro Aoyama ## 5, Sanfrecce Hiroshima (JPN)
23
- (16) MF Hotaru Yamaguchi ## 11, Cerezo Osaka (JPN)
24
- (17) MF Makoto Hasebe ## 78, 1. FC Nürnberg (GER)
25
-
26
- (9) FW Shinji Okazaki ## 75, Mainz 05 (GER)
27
- (11) FW Yoichiro Kakitani ## 11, Cerezo Osaka (JPN)
28
- (13) FW Yoshito Ōkubo ## 56, Kawasaki Frontale (JPN)
29
- (18) FW Yuya Osako ## 8, 1860 München (GER)
30
- (20) FW Manabu Saitō ## 4, Yokohama F. Marinos (JPN)
@@ -1,32 +0,0 @@
1
- #######
2
- # note: try without (w/o) jersey number e.g. use - instead of (1) (12) etc.
3
- # - players NOT in players database; will get auto-created for testing
4
-
5
-
6
- - GK Fernando Muslera ## 57, Galatasaray (TUR)
7
- - GK Rodrigo Muñoz ## 0, Libertad (PAR)
8
- - GK Martín Silva ## 4, Vasco da Gama (BRA)
9
-
10
- - DF Diego Lugano ## 93, West Bromwich Albion (ENG)
11
- - DF Diego Godín ## 76, Atlético Madrid (ESP)
12
- - DF Sebastián Coates ## 14, Nacional (URU)
13
- - DF Jorge Fucile ## 41, Porto (POR)
14
- - DF Maxi Pereira ## 89, Benfica (POR)
15
- - DF José María Giménez ## 5, Atlético Madrid (ESP)
16
- - DF Martín Cáceres ## 56, Juventus (ITA)
17
-
18
- - MF Walter Gargano ## 62, Parma (ITA)
19
- - MF Álvaro Pereira ## 56, São Paulo (BRA)
20
- - MF Cristian Rodríguez ## 72, Atlético Madrid (ESP)
21
- - MF Nicolás Lodeiro ## 26, Botafogo (BRA)
22
- - MF Diego Pérez ## 89, Bologna (ITA)
23
- - MF Egidio Arévalo Ríos ## 54, Morelia (MEX)
24
- - MF Gastón Ramírez ## 28, Southampton (ENG)
25
- - MF Álvaro González ## 42, Lazio (ITA)
26
-
27
- - FW Abel Hernández ## 12, Palermo (ITA)
28
- - FW Luis Suárez ## 77, Liverpool (ENG)
29
- - FW Diego Forlán ## 109, Cerezo Osaka (JPN)
30
- - FW Christian Stuani ## 9, Espanyol (ESP)
31
- - FW Edinson Cavani ## 61, Paris Saint-Germain (FRA)
32
-
@@ -1,5 +0,0 @@
1
- ####################
2
- # Leagues
3
-
4
- world, World Cup
5
-
@@ -1,4 +0,0 @@
1
- #####################
2
- # Seasons / Years
3
-
4
- 1930
@@ -1,4 +0,0 @@
1
- #####################
2
- # Seasons / Years
3
-
4
- 1954
@@ -1,4 +0,0 @@
1
- #####################
2
- # Seasons / Years
3
-
4
- 1962
@@ -1,5 +0,0 @@
1
- #####################
2
- # Seasons / Years
3
-
4
- 1974
5
-
@@ -1,26 +0,0 @@
1
- #############################
2
- # 13 Teams
3
-
4
- ## -- South America
5
-
6
- arg, Argentina, ARG, ar
7
- bra, Brazil, BRA, br
8
- bol, Bolivia, BOL, bo
9
- chi, Chile, CHI, cl
10
- uru, Uruguay, URU, uy
11
- per, Peru, PER, pe
12
- par, Paraguay, PAR, py
13
-
14
-
15
- ## -- North and Central America
16
-
17
- mex, Mexico, MEX, mx
18
- usa, United States, USA, us
19
-
20
- ## -- Europe
21
-
22
- fra, France, FRA, fr
23
- yug, Yugoslavia, YUG, rs
24
- rou, Romania, ROU, ro
25
- bel, Belgium, BEL, be
26
-
@@ -1,30 +0,0 @@
1
- ##########################
2
- # 16 Teams
3
-
4
- ## -- Asia
5
-
6
- kor, South Korea, KOR, kr
7
-
8
- ## -- Europe
9
-
10
- aut, Austria, AUT, at
11
- bel, Belgium, BEL, be
12
- tch, Czechoslovakia, TCH, cz
13
- eng, England, ENG, en
14
- fra, France, FRA, fr
15
- frg, West Germany, FRG, de
16
- hun, Hungary, HUN, hu
17
- ita, Italy, ITA, it
18
- sco, Scotland, SCO, sc
19
- sui, Switzerland, SUI, ch
20
- tur, Turkey, TUR, tr
21
- yug, Yugoslavia, YUG, rs
22
-
23
- ## -- North and Central America
24
-
25
- mex, Mexico, MEX, mx
26
-
27
- ## -- South America
28
-
29
- bra, Brazil, BRA, br
30
- uru, Uruguay, URU, uy
@@ -1,29 +0,0 @@
1
- #############################
2
- # 16 Teams
3
-
4
- ## -- South America
5
-
6
- arg, Argentina, ARG, ar
7
- bra, Brazil, BRA, br
8
- chi, Chile, CHI, cl
9
- col, Colombia, COL, co
10
- uru, Uruguay, URU, uy
11
-
12
-
13
- ## -- North and Central America
14
-
15
- mex, Mexico, MEX, mx
16
-
17
- ## -- Europe
18
-
19
- bul, Bulgaria, BUL, bg
20
- tch, Czechoslovakia, TCH, cz
21
- eng, England, ENG, en
22
- frg, West Germany, FRG, de
23
- hun, Hungary, HUN, hu
24
- ita, Italy, ITA, it
25
- urs, Soviet Union, URS, ru
26
- esp, Spain, ESP, es
27
- sui, Switzerland, SUI, ch
28
- yug, Yugoslavia, YUG, rs
29
-
@@ -1,29 +0,0 @@
1
- ########################
2
- # 16 Teams
3
-
4
- # -- Africa
5
- zai, Zaire, ZAI, cd
6
-
7
- # -- Asia
8
- aus, Australia, AUS, au
9
-
10
- # -- Europe
11
- bul, Bulgaria, BUL, bg
12
- frg, West Germany, FRG, de
13
- gdr, East Germany, GDR, de
14
- ita, Italy, ITA, it
15
- ned, Netherlands, NED, nl
16
- pol, Poland, POL, pl
17
- sco, Scotland, SCO, sc
18
- swe, Sweden, SWE, se
19
- yug, Yugoslavia, YUG, rs
20
-
21
-
22
- # -- North and Central America
23
- hai, Haiti, HAI, ht
24
-
25
- # -- South America
26
- arg, Argentina, ARG, ar
27
- bra, Brazil, BRA, br
28
- chi, Chile, CHI, cl
29
- uru, Uruguay, URU, uy
@@ -1,199 +0,0 @@
1
- # encoding: utf-8
2
-
3
- ###
4
- # to run use
5
- # ruby -I ./lib -I ./test test/test_assoc_reader.rb
6
-
7
-
8
- require 'helper'
9
-
10
- class TestAssocReaderXX < MiniTest::Test # note: TestAssocReader alreay defined, thus, add xx
11
-
12
- def setup
13
- WorldDb.delete!
14
- SportDb.delete!
15
- PersonDb.delete!
16
- end
17
-
18
- def test_models
19
- assert_equal 0, Assoc.count
20
- assert_equal 0, Team.count
21
- assert_equal 0, AssocAssoc.count
22
-
23
- uefa = Assoc.create!( key: 'uefa', title: 'UEFA' )
24
- assert_equal 1, Assoc.count
25
-
26
- at = Country.create!( key: 'at', name: 'Austria', code: 'AUT', pop: 1, area: 1)
27
- assocaut = Assoc.create!( key: 'assocaut', title: 'Assoc Austria',
28
- national: true, country_id: at.id )
29
-
30
- aut = Team.create!( key: 'aut', title: 'Austria', code: 'AUT',
31
- country_id: at.id,
32
- assoc_id: assocaut.id )
33
-
34
- assert_equal 1, Team.count
35
- assert_equal 'Assoc Austria', aut.assoc.title # team.assoc belongs_to ref
36
- assert_equal 'Assoc Austria', at.assoc.title # country.assoc has_one ref
37
-
38
- assert_equal 0, AssocAssoc.count
39
-
40
- AssocAssoc.create!( assoc1_id: uefa.id, assoc2_id: assocaut.id )
41
-
42
- assert_equal 1, AssocAssoc.count
43
- assert_equal 1, uefa.member_assoc_assocs.count
44
- assert_equal 1, uefa.all_assocs.count
45
- assert_equal 0, uefa.sub_assocs.count
46
- assert_equal 1, uefa.national_assocs.count
47
- assert_equal 0, uefa.parent_assoc_assocs.count
48
- assert_equal 0, uefa.parent_assocs.count
49
- assert_equal 1, assocaut.parent_assoc_assocs.count
50
- assert_equal 1, assocaut.parent_assocs.count
51
- assert_equal 0, assocaut.member_assoc_assocs.count
52
- assert_equal 0, assocaut.all_assocs.count
53
-
54
-
55
- it = Country.create!( key: 'it', name: 'Italy', code: 'ITA', pop: 1, area: 1)
56
- associta = Assoc.create!( key: 'associta', title: 'Assoc Italy',
57
- national: true, country_id: it.id )
58
-
59
- ita = Team.create!( key: 'ita', title: 'Italy', code: 'ITA',
60
- country_id: it.id,
61
- assoc_id: associta.id )
62
-
63
- assert_equal 2, Team.count
64
- assert_equal 'Assoc Italy', ita.assoc.title # team.assoc belongs_to ref
65
- assert_equal 'Assoc Italy', it.assoc.title # country.assoc has_one ref
66
-
67
- AssocAssoc.create!( assoc1_id: uefa.id, assoc2_id: associta.id )
68
-
69
- assert_equal 2, AssocAssoc.count
70
- assert_equal 2, uefa.member_assoc_assocs.count
71
- assert_equal 2, uefa.national_assocs.count
72
- assert_equal 0, uefa.sub_assocs.count
73
- assert_equal 0, uefa.parent_assoc_assocs.count
74
- assert_equal 1, associta.parent_assoc_assocs.count
75
- assert_equal 0, associta.member_assoc_assocs.count
76
- end
77
-
78
-
79
- def test_assocs
80
- reader = TestAssocReader.from_file( 'national-teams/assocs' )
81
- reader.read()
82
-
83
- assert_equal 20, Assoc.count
84
-
85
- fifa = Assoc.find_by_key!( 'fifa' )
86
-
87
- assert_equal 'Fédération Internationale de Football Association (FIFA)', fifa.title
88
- assert_equal 1904, fifa.since
89
- assert_equal 'www.fifa.com', fifa.web
90
- assert_equal 0, fifa.parent_assoc_assocs.count
91
- assert_equal 6, fifa.member_assoc_assocs.count
92
- assert_equal 6, fifa.all_assocs.count
93
- assert_equal 6, fifa.sub_assocs.count
94
- assert_equal 0, fifa.national_assocs.count
95
- assert_equal 0, fifa.parent_assocs.count
96
-
97
- uefa = Assoc.find_by_key!( 'uefa' )
98
-
99
- assert_equal 'Union of European Football Associations (UEFA)', uefa.title
100
- assert_equal 1954, uefa.since
101
- assert_equal 'www.uefa.com', uefa.web
102
- assert_equal 1, uefa.parent_assoc_assocs.count
103
- assert_equal 0, uefa.member_assoc_assocs.count
104
- assert_equal 0, uefa.all_assocs.count
105
- assert_equal 0, uefa.sub_assocs.count
106
- assert_equal 0, uefa.national_assocs.count
107
- assert_equal 1, uefa.parent_assocs.count
108
-
109
- concacaf = Assoc.find_by_key!( 'concacaf' )
110
-
111
- assert_equal 'Confederation of North, Central American and Caribbean Association Football (CONCACAF)', concacaf.title
112
- assert_equal 1961, concacaf.since
113
- assert_equal 1, concacaf.parent_assoc_assocs.count
114
- assert_equal 3, concacaf.member_assoc_assocs.count
115
- assert_equal 3, concacaf.all_assocs.count
116
- assert_equal 3, concacaf.sub_assocs.count
117
- assert_equal 0, concacaf.national_assocs.count
118
- assert_equal 1, concacaf.parent_assocs.count
119
-
120
-
121
- mx = Country.create!( key: 'mx', name: 'Mexico', code: 'MEX', pop: 1, area: 1)
122
- ca = Country.create!( key: 'ca', name: 'Canada', code: 'CAN', pop: 1, area: 1)
123
- us = Country.create!( key: 'us', name: 'United States', code: 'USA', pop: 1, area: 1)
124
-
125
- reader = TestAssocReader.from_file( 'national-teams/north-america/assocs' )
126
- reader.read()
127
-
128
- assert_equal 23, Assoc.count
129
-
130
- assert_equal 6+3, fifa.all_assocs.count
131
- assert_equal 6, fifa.sub_assocs.count
132
- assert_equal 0+3, fifa.national_assocs.count
133
-
134
- assert_equal 3+3, concacaf.all_assocs.count
135
- assert_equal 3, concacaf.sub_assocs.count
136
- assert_equal 0+3, concacaf.national_assocs.count
137
- assert_equal 1, concacaf.parent_assocs.count
138
-
139
- assocusa = Assoc.find_by_key!( 'assocusa' )
140
- assert_equal 'United States Soccer Federation', assocusa.title
141
- assert_equal 3, assocusa.parent_assocs.count
142
- assert_equal 0, assocusa.all_assocs.count
143
- assert_equal 0, assocusa.sub_assocs.count
144
- assert_equal 0, assocusa.national_assocs.count
145
-
146
- end # method test_assocs
147
-
148
-
149
- def test_teams
150
- assocreader = TestAssocReader.from_file( 'national-teams/assocs' )
151
- assocreader.read()
152
-
153
- assert_equal 20, Assoc.count
154
-
155
- ## add countries
156
- countries = [['mx', 'Mexico', 'MEX'],
157
- ['us', 'United States', 'USA'],
158
- ['ca', 'Canada', 'CAN'],
159
- ['dz', 'Algeria', 'ALG'],
160
- ['eg', 'Egypt', 'EGY'],
161
- ['au', 'Australia', 'AUS'],
162
- ['nz', 'New Zealand', 'NZL'],
163
- ['ki', 'Kiribati', 'KIR'],
164
- ['tv', 'Tuvalu', 'TUV']]
165
-
166
- countries.each do |country|
167
- Country.create!( key: country[0],
168
- name: country[1],
169
- code: country[2],
170
- pop: 1,
171
- area: 1)
172
- end
173
-
174
- teamreader = TestTeamReader.from_file( 'national-teams/teams' )
175
- teamreader.read()
176
- teamreader = TestTeamReader.from_file( 'national-teams/north-america/teams' )
177
- teamreader.read()
178
-
179
- assert_equal 9, Team.count
180
-
181
- ## fifa = Assoc.find_by_key!( 'fifa' )
182
- ## assert_equal 7, fifa.teams.count
183
-
184
- ## ofc = Assoc.find_by_key!( 'ofc' )
185
- ## assert_equal 3, ofc.teams.count
186
-
187
- ## mex = Team.find_by_key!( 'mex' )
188
- ## assert_equal 3, mex.assocs.count
189
-
190
- ## tuv = Team.find_by_key!( 'tuv' )
191
- ## assert_equal 1, tuv.assocs.count
192
-
193
- ### fix/todo: run teamreader again!! (2nd run)
194
- ## assert no new assocs (just update existing)
195
-
196
- end # method test_teams
197
-
198
-
199
- end # class TestAssocReader