chgk_rating 1.0.0.rc1 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. checksums.yaml +4 -4
  2. data/.github/ISSUE_TEMPLATE.md +12 -12
  3. data/.github/PULL_REQUEST_TEMPLATE.md +10 -10
  4. data/CHANGELOG.md +7 -0
  5. data/Gemfile +2 -6
  6. data/LICENSE +21 -21
  7. data/README.md +2 -1
  8. data/Rakefile +12 -12
  9. data/chgk_rating.gemspec +28 -28
  10. data/lib/chgk_rating.rb +51 -52
  11. data/lib/chgk_rating/attribute_mappings.rb +138 -137
  12. data/lib/chgk_rating/chgk_object.rb +12 -12
  13. data/lib/chgk_rating/client.rb +172 -172
  14. data/lib/chgk_rating/collections/base.rb +78 -78
  15. data/lib/chgk_rating/collections/players.rb +16 -16
  16. data/lib/chgk_rating/collections/ratings.rb +22 -22
  17. data/lib/chgk_rating/collections/recaps.rb +24 -24
  18. data/lib/chgk_rating/collections/teams.rb +16 -16
  19. data/lib/chgk_rating/collections/tournament_players.rb +23 -23
  20. data/lib/chgk_rating/collections/tournament_team_results.rb +23 -23
  21. data/lib/chgk_rating/collections/tournament_teams.rb +21 -21
  22. data/lib/chgk_rating/collections/tournaments.rb +46 -46
  23. data/lib/chgk_rating/concerns/searching.rb +24 -20
  24. data/lib/chgk_rating/connection.rb +18 -18
  25. data/lib/chgk_rating/error.rb +45 -45
  26. data/lib/chgk_rating/models/base.rb +89 -89
  27. data/lib/chgk_rating/models/player.rb +10 -10
  28. data/lib/chgk_rating/models/rating.rb +18 -18
  29. data/lib/chgk_rating/models/recap.rb +18 -18
  30. data/lib/chgk_rating/models/team.rb +61 -61
  31. data/lib/chgk_rating/models/tournament.rb +45 -45
  32. data/lib/chgk_rating/models/tournament_player.rb +7 -7
  33. data/lib/chgk_rating/models/tournament_team.rb +28 -28
  34. data/lib/chgk_rating/models/tournament_team_result.rb +7 -7
  35. data/lib/chgk_rating/request.rb +31 -31
  36. data/lib/chgk_rating/utils/snakecase.rb +15 -15
  37. data/lib/chgk_rating/utils/transformations.rb +82 -82
  38. data/lib/chgk_rating/version.rb +2 -2
  39. data/lib/ext/date.rb +10 -10
  40. data/lib/ext/date_time.rb +4 -4
  41. data/lib/ext/uri.rb +8 -8
  42. data/spec/lib/chgk_rating/client_spec.rb +207 -197
  43. data/spec/lib/chgk_rating/collections/players_spec.rb +44 -44
  44. data/spec/lib/chgk_rating/collections/ratings_spec.rb +24 -24
  45. data/spec/lib/chgk_rating/collections/recaps_spec.rb +20 -20
  46. data/spec/lib/chgk_rating/collections/teams_spec.rb +41 -41
  47. data/spec/lib/chgk_rating/collections/tournament_players_spec.rb +17 -17
  48. data/spec/lib/chgk_rating/collections/tournament_team_results_spec.rb +16 -16
  49. data/spec/lib/chgk_rating/collections/tournament_teams_spec.rb +59 -57
  50. data/spec/lib/chgk_rating/collections/tournaments_spec.rb +61 -61
  51. data/spec/lib/chgk_rating/models/base_spec.rb +33 -33
  52. data/spec/lib/chgk_rating/models/player_spec.rb +34 -34
  53. data/spec/lib/chgk_rating/models/rating_spec.rb +26 -26
  54. data/spec/lib/chgk_rating/models/recap_spec.rb +34 -34
  55. data/spec/lib/chgk_rating/models/team_spec.rb +88 -88
  56. data/spec/lib/chgk_rating/models/tournament_player_spec.rb +20 -20
  57. data/spec/lib/chgk_rating/models/tournament_spec.rb +91 -91
  58. data/spec/lib/chgk_rating/models/tournament_team_result_spec.rb +18 -18
  59. data/spec/lib/chgk_rating/models/tournament_team_spec.rb +35 -35
  60. data/spec/lib/chgk_rating/utils/snakecase_spec.rb +11 -11
  61. data/spec/lib/chgk_rating/utils/transformations_spec.rb +15 -15
  62. data/spec/lib/chgk_rating_spec.rb +4 -4
  63. data/spec/lib/ext/date_spec.rb +6 -6
  64. data/spec/lib/ext/date_time_spec.rb +10 -10
  65. data/spec/lib/ext/uri_spec.rb +6 -6
  66. data/spec/spec_helper.rb +12 -12
  67. data/spec/support/shared_examples.rb +62 -62
  68. data/spec/support/test_client.rb +5 -5
  69. data/spec/support/vcr.rb +10 -9
  70. metadata +5 -5
@@ -1,62 +1,62 @@
1
- RSpec.describe ChgkRating::Collections::Tournaments do
2
- context 'all tournaments for a team by season' do
3
- subject do
4
- VCR.use_cassette 'team_tournaments_season' do
5
- described_class.new(team: 1, season_id: 4)
6
- end
7
- end
8
-
9
- it_behaves_like 'not a hash'
10
- it_behaves_like 'an array'
11
-
12
- specify '#to_a' do
13
- tournaments_arr = subject.to_a
14
- expect(tournaments_arr[2]['idtournament']).to eq '150'
15
- end
16
- specify('#id') { expect(subject[0].id).to eq '188' }
17
- specify('#team') { expect(subject.team.id).to eq 1 }
18
- specify('#season_id') { expect(subject.season_id).to eq 4 }
19
- end
20
-
21
- context 'all tournaments' do
22
- subject do
23
- VCR.use_cassette 'tournaments' do
24
- described_class.new
25
- end
26
- end
27
- let(:tournament) { subject[0] }
28
-
29
- it_behaves_like 'not a hash'
30
- it_behaves_like 'an array'
31
-
32
- specify '#to_a' do
33
- tournaments_arr = subject.to_a
34
- expect(tournaments_arr[10]['idtournament']).to eq '3467'
35
- end
36
- specify('#id') { expect(tournament.id).to eq '4592' }
37
- specify('#name') { expect(tournament.name).to eq 'Гран-при Бауманки. Синхрон' }
38
- specify('#date_start') { expect(tournament.date_start).to eq DateTime.parse('2017-10-29 10:00:00') }
39
- specify('#date_end') { expect(tournament.date_end).to eq DateTime.parse('2018-08-23 10:00:00') }
40
- specify('#type_name') { expect(tournament.type_name).to eq 'Общий зачёт' }
41
- end
42
-
43
- context 'tournaments for a team' do
44
- subject do
45
- VCR.use_cassette 'team_tournaments' do
46
- described_class.new(team: 1)
47
- end
48
- end
49
- let(:tournament) { subject['8'][0] }
50
-
51
- it_behaves_like 'a hash'
52
- it_behaves_like 'not an array'
53
-
54
- specify '#to_h' do
55
- subject_h = subject.to_h['7']
56
- expect(subject_h['tournaments'][0]['idtournament']).to eq '367'
57
- expect(subject_h['idseason']).to eq '7'
58
- expect(subject_h['idteam']).to eq '1'
59
- end
60
- specify('#id') { expect(tournament.id).to eq '424' }
61
- end
1
+ RSpec.describe ChgkRating::Collections::Tournaments do
2
+ context 'all tournaments for a team by season' do
3
+ subject do
4
+ VCR.use_cassette 'team_tournaments_season' do
5
+ described_class.new(team: 1, season_id: 4)
6
+ end
7
+ end
8
+
9
+ it_behaves_like 'not a hash'
10
+ it_behaves_like 'an array'
11
+
12
+ specify '#to_a' do
13
+ tournaments_arr = subject.to_a
14
+ expect(tournaments_arr[2]['idtournament']).to eq '150'
15
+ end
16
+ specify('#id') { expect(subject[0].id).to eq '188' }
17
+ specify('#team') { expect(subject.team.id).to eq 1 }
18
+ specify('#season_id') { expect(subject.season_id).to eq 4 }
19
+ end
20
+
21
+ context 'all tournaments' do
22
+ subject do
23
+ VCR.use_cassette 'tournaments' do
24
+ described_class.new
25
+ end
26
+ end
27
+ let(:tournament) { subject[0] }
28
+
29
+ it_behaves_like 'not a hash'
30
+ it_behaves_like 'an array'
31
+
32
+ specify '#to_a' do
33
+ tournaments_arr = subject.to_a
34
+ expect(tournaments_arr[10]['idtournament']).to eq '1538'
35
+ end
36
+ specify('#id') { expect(tournament.id).to eq '1908' }
37
+ specify('#name') { expect(tournament.name).to eq 'Фестиваль в Мариуполе' }
38
+ specify('#date_start') { expect(tournament.date_start).to eq DateTime.parse('1989-09-01 00:00:00') }
39
+ specify('#date_end') { expect(tournament.date_end).to eq DateTime.parse('1989-09-03 00:00:00') }
40
+ specify('#type_name') { expect(tournament.type_name).to eq 'Обычный' }
41
+ end
42
+
43
+ context 'tournaments for a team' do
44
+ subject do
45
+ VCR.use_cassette 'team_tournaments' do
46
+ described_class.new(team: 1)
47
+ end
48
+ end
49
+ let(:tournament) { subject['8'][0] }
50
+
51
+ it_behaves_like 'a hash'
52
+ it_behaves_like 'not an array'
53
+
54
+ specify '#to_h' do
55
+ subject_h = subject.to_h['7']
56
+ expect(subject_h['tournaments'][0]['idtournament']).to eq '367'
57
+ expect(subject_h['idseason']).to eq '7'
58
+ expect(subject_h['idteam']).to eq '1'
59
+ end
60
+ specify('#id') { expect(tournament.id).to eq '424' }
61
+ end
62
62
  end
@@ -1,34 +1,34 @@
1
- RSpec.describe ChgkRating::Models::Base do
2
- describe '.no_lazy_support!' do
3
- let!(:klass) do
4
- Class.new(described_class) do
5
- no_lazy_support!
6
- def initialize ; end
7
- end
8
- end
9
-
10
- subject { klass.new }
11
-
12
- it { is_expected.not_to respond_to(:lazy) }
13
-
14
- it 'should define NO_LAZY_SUPPORT constant' do
15
- expect(klass::NO_LAZY_SUPPORT).to eq(true)
16
- end
17
- end
18
-
19
- describe '.no_eager_loading!' do
20
- let!(:klass) do
21
- Class.new(described_class) do
22
- no_eager_loading!
23
- def initialize ; end
24
- end
25
- end
26
-
27
- subject { klass.new }
28
-
29
- it 'should raise an EagerLoadingNotSupported error' do
30
- expect( -> { subject.eager_load! }).to raise_error(ChgkRating::Error::EagerLoadingNotSupported).
31
- with_message 'Eager loading is not supported for this resource.'
32
- end
33
- end
1
+ RSpec.describe ChgkRating::Models::Base do
2
+ describe '.no_lazy_support!' do
3
+ let!(:klass) do
4
+ Class.new(described_class) do
5
+ no_lazy_support!
6
+ def initialize ; end
7
+ end
8
+ end
9
+
10
+ subject { klass.new }
11
+
12
+ it { is_expected.not_to respond_to(:lazy) }
13
+
14
+ it 'should define NO_LAZY_SUPPORT constant' do
15
+ expect(klass::NO_LAZY_SUPPORT).to eq(true)
16
+ end
17
+ end
18
+
19
+ describe '.no_eager_loading!' do
20
+ let!(:klass) do
21
+ Class.new(described_class) do
22
+ no_eager_loading!
23
+ def initialize ; end
24
+ end
25
+ end
26
+
27
+ subject { klass.new }
28
+
29
+ it 'should raise an EagerLoadingNotSupported error' do
30
+ expect( -> { subject.eager_load! }).to raise_error(ChgkRating::Error::EagerLoadingNotSupported).
31
+ with_message 'Eager loading is not supported for this resource.'
32
+ end
33
+ end
34
34
  end
@@ -1,35 +1,35 @@
1
- RSpec.describe ChgkRating::Models::Player do
2
- subject do
3
- VCR.use_cassette 'player' do
4
- described_class.new 42511
5
- end
6
- end
7
- let(:player_h) { subject.to_h }
8
- let(:lazy_player) { described_class.new 42511, lazy: true }
9
-
10
- it_behaves_like 'model with eager loading'
11
- it_behaves_like 'model with lazy support'
12
-
13
- specify('#id') { expect(subject.id).to eq '42511' }
14
- specify('#surname') { expect(subject.surname).to eq 'Некрылов' }
15
- specify('#name') { expect(subject.name).to eq 'Николай' }
16
- specify('#patronymic') { expect(subject.patronymic).to eq 'Андреевич' }
17
- specify('#db_chgk_info_tag') { expect(subject.db_chgk_info_tag).to eq 'nnekrylov' }
18
- specify('#comment') { expect(subject.comment).to eq '' }
19
-
20
- specify '#to_h' do
21
- expect(player_h['idplayer']).to eq '42511'
22
- expect(player_h['name']).to eq 'Николай'
23
- expect(player_h['surname']).to eq 'Некрылов'
24
- expect(player_h['patronymic']).to eq 'Андреевич'
25
- expect(player_h['comment']).to eq ''
26
- expect(player_h['db_chgk_info_tag']).to eq 'nnekrylov'
27
- end
28
-
29
- specify '#eager_load!' do
30
- VCR.use_cassette 'player' do
31
- lazy_player.eager_load!
32
- end
33
- expect(lazy_player.name).to eq 'Николай'
34
- end
1
+ RSpec.describe ChgkRating::Models::Player do
2
+ subject do
3
+ VCR.use_cassette 'player' do
4
+ described_class.new 42511
5
+ end
6
+ end
7
+ let(:player_h) { subject.to_h }
8
+ let(:lazy_player) { described_class.new 42511, lazy: true }
9
+
10
+ it_behaves_like 'model with eager loading'
11
+ it_behaves_like 'model with lazy support'
12
+
13
+ specify('#id') { expect(subject.id).to eq '42511' }
14
+ specify('#surname') { expect(subject.surname).to eq 'Некрылов' }
15
+ specify('#name') { expect(subject.name).to eq 'Николай' }
16
+ specify('#patronymic') { expect(subject.patronymic).to eq 'Андреевич' }
17
+ specify('#db_chgk_info_tag') { expect(subject.db_chgk_info_tag).to eq 'nnekrylov' }
18
+ specify('#comment') { expect(subject.comment).to eq '' }
19
+
20
+ specify '#to_h' do
21
+ expect(player_h['idplayer']).to eq '42511'
22
+ expect(player_h['name']).to eq 'Николай'
23
+ expect(player_h['surname']).to eq 'Некрылов'
24
+ expect(player_h['patronymic']).to eq 'Андреевич'
25
+ expect(player_h['comment']).to eq ''
26
+ expect(player_h['db_chgk_info_tag']).to eq 'nnekrylov'
27
+ end
28
+
29
+ specify '#eager_load!' do
30
+ VCR.use_cassette 'player' do
31
+ lazy_player.eager_load!
32
+ end
33
+ expect(lazy_player.name).to eq 'Николай'
34
+ end
35
35
  end
@@ -1,27 +1,27 @@
1
- RSpec.describe ChgkRating::Models::Rating do
2
- subject do
3
- VCR.use_cassette 'rating_release' do
4
- described_class.new 24, team: 1
5
- end
6
- end
7
- let(:rating_h) { subject.to_h }
8
-
9
- it_behaves_like 'model without eager loading'
10
- it_behaves_like 'model without lazy support'
11
-
12
- specify('#team') { expect(subject.team.id).to eq '1' }
13
- specify('#release_id') { expect(subject.release_id).to eq '24' }
14
- specify('#rating') { expect(subject.rating).to eq 9071 }
15
- specify('#rating_position') { expect(subject.rating_position).to eq 9 }
16
- specify('#date') { expect(subject.date).to eq Date.new(1999, 01, 07) }
17
- specify('#formula') { expect(subject.formula).to eq :b }
18
-
19
- specify '#to_h' do
20
- expect(rating_h['idteam']).to eq '1'
21
- expect(rating_h['idrelease']).to eq '24'
22
- expect(rating_h['rating']).to eq '9071'
23
- expect(rating_h['rating_position']).to eq '9'
24
- expect(rating_h['date']).to eq '1999-01-07'
25
- expect(rating_h['formula']).to eq 'b'
26
- end
1
+ RSpec.describe ChgkRating::Models::Rating do
2
+ subject do
3
+ VCR.use_cassette 'rating_release' do
4
+ described_class.new 24, team: 1
5
+ end
6
+ end
7
+ let(:rating_h) { subject.to_h }
8
+
9
+ it_behaves_like 'model without eager loading'
10
+ it_behaves_like 'model without lazy support'
11
+
12
+ specify('#team') { expect(subject.team.id).to eq '1' }
13
+ specify('#release_id') { expect(subject.release_id).to eq '24' }
14
+ specify('#rating') { expect(subject.rating).to eq 9071 }
15
+ specify('#rating_position') { expect(subject.rating_position).to eq 9 }
16
+ specify('#date') { expect(subject.date).to eq Date.new(1999, 01, 07) }
17
+ specify('#formula') { expect(subject.formula).to eq :b }
18
+
19
+ specify '#to_h' do
20
+ expect(rating_h['idteam']).to eq '1'
21
+ expect(rating_h['idrelease']).to eq '24'
22
+ expect(rating_h['rating']).to eq '9071'
23
+ expect(rating_h['rating_position']).to eq '9'
24
+ expect(rating_h['date']).to eq '1999-01-07'
25
+ expect(rating_h['formula']).to eq 'b'
26
+ end
27
27
  end
@@ -1,35 +1,35 @@
1
- RSpec.describe ChgkRating::Models::Recap do
2
- subject do
3
- VCR.use_cassette 'recap_last_season' do
4
- described_class.new :last, team: 7931
5
- end
6
- end
7
- let(:recap_h) { subject.to_h }
8
-
9
- it_behaves_like 'model without eager loading'
10
- it_behaves_like 'model without lazy support'
11
-
12
- specify('#season_id') { expect(subject.season_id).to eq '51' }
13
- specify('#team') { expect(subject.team.id).to eq '7931' }
14
- specify('#captain') { expect(subject.captain.id).to eq '23539' }
15
- specify('#players') { expect(subject.players.first.id).to eq '2668' }
16
- specify '#to_h' do
17
- expect(recap_h['idseason']).to eq '51'
18
- expect(recap_h['idteam']).to eq '7931'
19
- expect(recap_h['captain']).to eq '23539'
20
- expect(recap_h['players']).to eq %w(2668 6654 23539 53735 94783 98697 115867)
21
- end
22
-
23
- context 'with season number' do
24
- subject do
25
- VCR.use_cassette 'recap' do
26
- described_class.new 9, team: 1
27
- end
28
- end
29
-
30
- specify('#season_id') { expect(subject.season_id).to eq '9' }
31
- specify('#team') { expect(subject.team.id).to eq '1' }
32
- specify('#captain') { expect(subject.captain.id).to eq '2935' }
33
- specify('#players') { expect(subject.players.first.id).to eq '2935' }
34
- end
1
+ RSpec.describe ChgkRating::Models::Recap do
2
+ subject do
3
+ VCR.use_cassette 'recap_last_season' do
4
+ described_class.new :last, team: 7931
5
+ end
6
+ end
7
+ let(:recap_h) { subject.to_h }
8
+
9
+ it_behaves_like 'model without eager loading'
10
+ it_behaves_like 'model without lazy support'
11
+
12
+ specify('#season_id') { expect(subject.season_id).to eq '51' }
13
+ specify('#team') { expect(subject.team.id).to eq '7931' }
14
+ specify('#captain') { expect(subject.captain.id).to eq '23539' }
15
+ specify('#players') { expect(subject.players.first.id).to eq '2668' }
16
+ specify '#to_h' do
17
+ expect(recap_h['idseason']).to eq '51'
18
+ expect(recap_h['idteam']).to eq '7931'
19
+ expect(recap_h['captain']).to eq '23539'
20
+ expect(recap_h['players']).to eq %w(2668 6654 23539 53735 94783 98697 115867 149858)
21
+ end
22
+
23
+ context 'with season number' do
24
+ subject do
25
+ VCR.use_cassette 'recap' do
26
+ described_class.new 9, team: 1
27
+ end
28
+ end
29
+
30
+ specify('#season_id') { expect(subject.season_id).to eq '9' }
31
+ specify('#team') { expect(subject.team.id).to eq '1' }
32
+ specify('#captain') { expect(subject.captain.id).to eq '2935' }
33
+ specify('#players') { expect(subject.players.first.id).to eq '2935' }
34
+ end
35
35
  end
@@ -1,89 +1,89 @@
1
- RSpec.describe ChgkRating::Models::Team do
2
- subject do
3
- VCR.use_cassette 'team' do
4
- described_class.new 1
5
- end
6
- end
7
- let(:team_h) { subject.to_h }
8
- let(:lazy_team) { described_class.new 1, lazy: true }
9
-
10
- it_behaves_like 'model with eager loading'
11
- it_behaves_like 'model with lazy support'
12
-
13
- specify('#id') { expect(subject.id).to eq '1' }
14
- specify('#town') { expect(subject.town).to eq 'Москва' }
15
- specify('#name') { expect(subject.name).to eq 'Неспроста' }
16
- specify('#comment') { expect(subject.comment).to eq '' }
17
-
18
- specify '#tournaments' do
19
- tournaments = VCR.use_cassette 'team_tournaments' do
20
- subject.tournaments['2']
21
- end
22
-
23
- expect(tournaments[0].id).to eq '54'
24
- expect(tournaments[1].id).to eq '25'
25
- end
26
-
27
- specify '#to_h' do
28
- expect(team_h['idteam']).to eq '1'
29
- expect(team_h['name']).to eq 'Неспроста'
30
- expect(team_h['town']).to eq 'Москва'
31
- expect(team_h['comment']).to eq ''
32
- end
33
-
34
- specify '#eager_load!' do
35
- VCR.use_cassette 'team' do
36
- lazy_team.eager_load!
37
- end
38
- expect(lazy_team.name).to eq 'Неспроста'
39
- end
40
-
41
- describe '#at_tournament' do
42
- it { expect(subject.at_tournament('1000')).to be_an_instance_of ChgkRating::Models::TournamentTeam }
43
- end
44
-
45
- describe '#rating' do
46
- let(:team_rating) do
47
- VCR.use_cassette 'rating_release' do
48
- subject.rating 24
49
- end
50
- end
51
- it { expect(team_rating).to be_an_instance_of ChgkRating::Models::Rating }
52
- end
53
-
54
- describe '#recap' do
55
- let(:team_recap) do
56
- VCR.use_cassette 'recap' do
57
- subject.recap 9
58
- end
59
- end
60
- it { expect(team_recap).to be_an_instance_of ChgkRating::Models::Recap }
61
- end
62
-
63
- describe '#recaps' do
64
- let(:team_recaps) do
65
- VCR.use_cassette 'recaps' do
66
- subject.recaps
67
- end
68
- end
69
- it { expect(team_recaps).to be_an_instance_of ChgkRating::Collections::Recaps }
70
- end
71
-
72
- describe '#tournaments' do
73
- let(:team_tournaments) do
74
- VCR.use_cassette 'team_tournaments' do
75
- subject.tournaments
76
- end
77
- end
78
- it { expect(team_tournaments).to be_an_instance_of ChgkRating::Collections::Tournaments }
79
- end
80
-
81
- describe '#ratings' do
82
- let(:team_ratings) do
83
- VCR.use_cassette 'team_ratings' do
84
- subject.ratings
85
- end
86
- end
87
- it { expect(team_ratings).to be_an_instance_of ChgkRating::Collections::Ratings }
88
- end
1
+ RSpec.describe ChgkRating::Models::Team do
2
+ subject do
3
+ VCR.use_cassette 'team' do
4
+ described_class.new 1
5
+ end
6
+ end
7
+ let(:team_h) { subject.to_h }
8
+ let(:lazy_team) { described_class.new 1, lazy: true }
9
+
10
+ it_behaves_like 'model with eager loading'
11
+ it_behaves_like 'model with lazy support'
12
+
13
+ specify('#id') { expect(subject.id).to eq '1' }
14
+ specify('#town') { expect(subject.town).to eq 'Москва' }
15
+ specify('#name') { expect(subject.name).to eq 'Неспроста' }
16
+ specify('#comment') { expect(subject.comment).to eq '' }
17
+
18
+ specify '#tournaments' do
19
+ tournaments = VCR.use_cassette 'team_tournaments' do
20
+ subject.tournaments['2']
21
+ end
22
+
23
+ expect(tournaments[0].id).to eq '54'
24
+ expect(tournaments[1].id).to eq '25'
25
+ end
26
+
27
+ specify '#to_h' do
28
+ expect(team_h['idteam']).to eq '1'
29
+ expect(team_h['name']).to eq 'Неспроста'
30
+ expect(team_h['town']).to eq 'Москва'
31
+ expect(team_h['comment']).to eq ''
32
+ end
33
+
34
+ specify '#eager_load!' do
35
+ VCR.use_cassette 'team' do
36
+ lazy_team.eager_load!
37
+ end
38
+ expect(lazy_team.name).to eq 'Неспроста'
39
+ end
40
+
41
+ describe '#at_tournament' do
42
+ it { expect(subject.at_tournament('1000')).to be_an_instance_of ChgkRating::Models::TournamentTeam }
43
+ end
44
+
45
+ describe '#rating' do
46
+ let(:team_rating) do
47
+ VCR.use_cassette 'rating_release' do
48
+ subject.rating 24
49
+ end
50
+ end
51
+ it { expect(team_rating).to be_an_instance_of ChgkRating::Models::Rating }
52
+ end
53
+
54
+ describe '#recap' do
55
+ let(:team_recap) do
56
+ VCR.use_cassette 'recap' do
57
+ subject.recap 9
58
+ end
59
+ end
60
+ it { expect(team_recap).to be_an_instance_of ChgkRating::Models::Recap }
61
+ end
62
+
63
+ describe '#recaps' do
64
+ let(:team_recaps) do
65
+ VCR.use_cassette 'recaps' do
66
+ subject.recaps
67
+ end
68
+ end
69
+ it { expect(team_recaps).to be_an_instance_of ChgkRating::Collections::Recaps }
70
+ end
71
+
72
+ describe '#tournaments' do
73
+ let(:team_tournaments) do
74
+ VCR.use_cassette 'team_tournaments' do
75
+ subject.tournaments
76
+ end
77
+ end
78
+ it { expect(team_tournaments).to be_an_instance_of ChgkRating::Collections::Tournaments }
79
+ end
80
+
81
+ describe '#ratings' do
82
+ let(:team_ratings) do
83
+ VCR.use_cassette 'team_ratings' do
84
+ subject.ratings
85
+ end
86
+ end
87
+ it { expect(team_ratings).to be_an_instance_of ChgkRating::Collections::Ratings }
88
+ end
89
89
  end