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.
- checksums.yaml +4 -4
- data/.github/ISSUE_TEMPLATE.md +12 -12
- data/.github/PULL_REQUEST_TEMPLATE.md +10 -10
- data/CHANGELOG.md +7 -0
- data/Gemfile +2 -6
- data/LICENSE +21 -21
- data/README.md +2 -1
- data/Rakefile +12 -12
- data/chgk_rating.gemspec +28 -28
- data/lib/chgk_rating.rb +51 -52
- data/lib/chgk_rating/attribute_mappings.rb +138 -137
- data/lib/chgk_rating/chgk_object.rb +12 -12
- data/lib/chgk_rating/client.rb +172 -172
- data/lib/chgk_rating/collections/base.rb +78 -78
- data/lib/chgk_rating/collections/players.rb +16 -16
- data/lib/chgk_rating/collections/ratings.rb +22 -22
- data/lib/chgk_rating/collections/recaps.rb +24 -24
- data/lib/chgk_rating/collections/teams.rb +16 -16
- data/lib/chgk_rating/collections/tournament_players.rb +23 -23
- data/lib/chgk_rating/collections/tournament_team_results.rb +23 -23
- data/lib/chgk_rating/collections/tournament_teams.rb +21 -21
- data/lib/chgk_rating/collections/tournaments.rb +46 -46
- data/lib/chgk_rating/concerns/searching.rb +24 -20
- data/lib/chgk_rating/connection.rb +18 -18
- data/lib/chgk_rating/error.rb +45 -45
- data/lib/chgk_rating/models/base.rb +89 -89
- data/lib/chgk_rating/models/player.rb +10 -10
- data/lib/chgk_rating/models/rating.rb +18 -18
- data/lib/chgk_rating/models/recap.rb +18 -18
- data/lib/chgk_rating/models/team.rb +61 -61
- data/lib/chgk_rating/models/tournament.rb +45 -45
- data/lib/chgk_rating/models/tournament_player.rb +7 -7
- data/lib/chgk_rating/models/tournament_team.rb +28 -28
- data/lib/chgk_rating/models/tournament_team_result.rb +7 -7
- data/lib/chgk_rating/request.rb +31 -31
- data/lib/chgk_rating/utils/snakecase.rb +15 -15
- data/lib/chgk_rating/utils/transformations.rb +82 -82
- data/lib/chgk_rating/version.rb +2 -2
- data/lib/ext/date.rb +10 -10
- data/lib/ext/date_time.rb +4 -4
- data/lib/ext/uri.rb +8 -8
- data/spec/lib/chgk_rating/client_spec.rb +207 -197
- data/spec/lib/chgk_rating/collections/players_spec.rb +44 -44
- data/spec/lib/chgk_rating/collections/ratings_spec.rb +24 -24
- data/spec/lib/chgk_rating/collections/recaps_spec.rb +20 -20
- data/spec/lib/chgk_rating/collections/teams_spec.rb +41 -41
- data/spec/lib/chgk_rating/collections/tournament_players_spec.rb +17 -17
- data/spec/lib/chgk_rating/collections/tournament_team_results_spec.rb +16 -16
- data/spec/lib/chgk_rating/collections/tournament_teams_spec.rb +59 -57
- data/spec/lib/chgk_rating/collections/tournaments_spec.rb +61 -61
- data/spec/lib/chgk_rating/models/base_spec.rb +33 -33
- data/spec/lib/chgk_rating/models/player_spec.rb +34 -34
- data/spec/lib/chgk_rating/models/rating_spec.rb +26 -26
- data/spec/lib/chgk_rating/models/recap_spec.rb +34 -34
- data/spec/lib/chgk_rating/models/team_spec.rb +88 -88
- data/spec/lib/chgk_rating/models/tournament_player_spec.rb +20 -20
- data/spec/lib/chgk_rating/models/tournament_spec.rb +91 -91
- data/spec/lib/chgk_rating/models/tournament_team_result_spec.rb +18 -18
- data/spec/lib/chgk_rating/models/tournament_team_spec.rb +35 -35
- data/spec/lib/chgk_rating/utils/snakecase_spec.rb +11 -11
- data/spec/lib/chgk_rating/utils/transformations_spec.rb +15 -15
- data/spec/lib/chgk_rating_spec.rb +4 -4
- data/spec/lib/ext/date_spec.rb +6 -6
- data/spec/lib/ext/date_time_spec.rb +10 -10
- data/spec/lib/ext/uri_spec.rb +6 -6
- data/spec/spec_helper.rb +12 -12
- data/spec/support/shared_examples.rb +62 -62
- data/spec/support/test_client.rb +5 -5
- data/spec/support/vcr.rb +10 -9
- metadata +5 -5
@@ -1,45 +1,45 @@
|
|
1
|
-
RSpec.describe ChgkRating::Collections::Players do
|
2
|
-
let(:player) { subject[1] }
|
3
|
-
subject do
|
4
|
-
VCR.use_cassette 'players' do
|
5
|
-
described_class.new
|
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
|
-
players_arr = subject.to_a
|
14
|
-
expect(players_arr.count).to eq 1000
|
15
|
-
expect(players_arr[10]['surname']).to eq 'Абарников'
|
16
|
-
end
|
17
|
-
specify('#id') { expect(player.id).to eq '6' }
|
18
|
-
specify('#surname') { expect(player.surname).to eq 'Абаков' }
|
19
|
-
specify('#name') { expect(player.name).to eq 'Карен' }
|
20
|
-
it 'respond_to should still work properly' do
|
21
|
-
expect(subject.respond_to?(:count)).to eq true
|
22
|
-
end
|
23
|
-
|
24
|
-
context 'searching' do
|
25
|
-
subject do
|
26
|
-
VCR.use_cassette 'players_searching' do
|
27
|
-
test_client.search_players(name: 'вас', surname: 'а')[28]
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
specify('#id') { expect(subject.id).to eq '148380' }
|
32
|
-
specify('#surname') { expect(subject.surname).to eq 'Абросимов' }
|
33
|
-
end
|
34
|
-
|
35
|
-
context 'pagination' do
|
36
|
-
subject do
|
37
|
-
VCR.use_cassette 'players_page3' do
|
38
|
-
described_class.new(page: 3)[1]
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
specify('#id') { expect(subject.id).to eq '2101' }
|
43
|
-
specify('#surname') { expect(subject.surname).to eq 'Бажов' }
|
44
|
-
end
|
1
|
+
RSpec.describe ChgkRating::Collections::Players do
|
2
|
+
let(:player) { subject[1] }
|
3
|
+
subject do
|
4
|
+
VCR.use_cassette 'players' do
|
5
|
+
described_class.new
|
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
|
+
players_arr = subject.to_a
|
14
|
+
expect(players_arr.count).to eq 1000
|
15
|
+
expect(players_arr[10]['surname']).to eq 'Абарников'
|
16
|
+
end
|
17
|
+
specify('#id') { expect(player.id).to eq '6' }
|
18
|
+
specify('#surname') { expect(player.surname).to eq 'Абаков' }
|
19
|
+
specify('#name') { expect(player.name).to eq 'Карен' }
|
20
|
+
it 'respond_to should still work properly' do
|
21
|
+
expect(subject.respond_to?(:count)).to eq true
|
22
|
+
end
|
23
|
+
|
24
|
+
context 'searching' do
|
25
|
+
subject do
|
26
|
+
VCR.use_cassette 'players_searching' do
|
27
|
+
test_client.search_players(name: 'вас', surname: 'а')[28]
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
specify('#id') { expect(subject.id).to eq '148380' }
|
32
|
+
specify('#surname') { expect(subject.surname).to eq 'Абросимов' }
|
33
|
+
end
|
34
|
+
|
35
|
+
context 'pagination' do
|
36
|
+
subject do
|
37
|
+
VCR.use_cassette 'players_page3' do
|
38
|
+
described_class.new(page: 3)[1]
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
specify('#id') { expect(subject.id).to eq '2101' }
|
43
|
+
specify('#surname') { expect(subject.surname).to eq 'Бажов' }
|
44
|
+
end
|
45
45
|
end
|
@@ -1,25 +1,25 @@
|
|
1
|
-
RSpec.describe ChgkRating::Collections::Ratings do
|
2
|
-
subject do
|
3
|
-
VCR.use_cassette 'team_ratings' do
|
4
|
-
described_class.new(team: 1)
|
5
|
-
end
|
6
|
-
end
|
7
|
-
let(:ratings) do
|
8
|
-
subject[0]
|
9
|
-
end
|
10
|
-
|
11
|
-
it_behaves_like 'not a hash'
|
12
|
-
it_behaves_like 'an array'
|
13
|
-
|
14
|
-
specify '#to_a' do
|
15
|
-
ratings_arr = subject.to_a
|
16
|
-
expect(ratings_arr.count).to eq 572
|
17
|
-
expect(ratings_arr[500]['date']).to eq '2006-
|
18
|
-
end
|
19
|
-
specify('#date') { expect(ratings.date.to_s).to eq '2003-07-01' }
|
20
|
-
specify('#formula') { expect(ratings.formula).to eq :a }
|
21
|
-
specify('#rating_position') { expect(ratings.rating_position).to eq 8 }
|
22
|
-
specify('#release_id') { expect(ratings.release_id).to eq '1' }
|
23
|
-
specify('#team') { expect(ratings.team.id).to eq '1' }
|
24
|
-
specify('#rating') { expect(ratings.rating).to eq 6093 }
|
1
|
+
RSpec.describe ChgkRating::Collections::Ratings do
|
2
|
+
subject do
|
3
|
+
VCR.use_cassette 'team_ratings' do
|
4
|
+
described_class.new(team: 1)
|
5
|
+
end
|
6
|
+
end
|
7
|
+
let(:ratings) do
|
8
|
+
subject[0]
|
9
|
+
end
|
10
|
+
|
11
|
+
it_behaves_like 'not a hash'
|
12
|
+
it_behaves_like 'an array'
|
13
|
+
|
14
|
+
specify '#to_a' do
|
15
|
+
ratings_arr = subject.to_a
|
16
|
+
expect(ratings_arr.count).to eq 572
|
17
|
+
expect(ratings_arr[500]['date']).to eq '2006-08-17'
|
18
|
+
end
|
19
|
+
specify('#date') { expect(ratings.date.to_s).to eq '2003-07-01' }
|
20
|
+
specify('#formula') { expect(ratings.formula).to eq :a }
|
21
|
+
specify('#rating_position') { expect(ratings.rating_position).to eq 8 }
|
22
|
+
specify('#release_id') { expect(ratings.release_id).to eq '1' }
|
23
|
+
specify('#team') { expect(ratings.team.id).to eq '1' }
|
24
|
+
specify('#rating') { expect(ratings.rating).to eq 6093 }
|
25
25
|
end
|
@@ -1,21 +1,21 @@
|
|
1
|
-
RSpec.describe ChgkRating::Collections::Recaps do
|
2
|
-
subject do
|
3
|
-
VCR.use_cassette 'recaps' do
|
4
|
-
described_class.new(team: 1)
|
5
|
-
end
|
6
|
-
end
|
7
|
-
let(:recaps) { subject['6'] }
|
8
|
-
|
9
|
-
it_behaves_like 'a hash'
|
10
|
-
it_behaves_like 'not an array'
|
11
|
-
|
12
|
-
specify '#to_h' do
|
13
|
-
recaps_h = subject.to_h
|
14
|
-
expect(recaps_h['6']['idseason']).to eq '6'
|
15
|
-
expect(recaps_h['6']['captain']).to eq '2935'
|
16
|
-
end
|
17
|
-
specify('#season_id') { expect(recaps.season_id).to eq '6' }
|
18
|
-
specify('#team') { expect(recaps.team.id).to eq '1' }
|
19
|
-
specify('#captain') { expect(recaps.captain.id).to eq '2935' }
|
20
|
-
specify('#players') { expect(recaps.players.first.id).to eq '1585' }
|
1
|
+
RSpec.describe ChgkRating::Collections::Recaps do
|
2
|
+
subject do
|
3
|
+
VCR.use_cassette 'recaps' do
|
4
|
+
described_class.new(team: 1)
|
5
|
+
end
|
6
|
+
end
|
7
|
+
let(:recaps) { subject['6'] }
|
8
|
+
|
9
|
+
it_behaves_like 'a hash'
|
10
|
+
it_behaves_like 'not an array'
|
11
|
+
|
12
|
+
specify '#to_h' do
|
13
|
+
recaps_h = subject.to_h
|
14
|
+
expect(recaps_h['6']['idseason']).to eq '6'
|
15
|
+
expect(recaps_h['6']['captain']).to eq '2935'
|
16
|
+
end
|
17
|
+
specify('#season_id') { expect(recaps.season_id).to eq '6' }
|
18
|
+
specify('#team') { expect(recaps.team.id).to eq '1' }
|
19
|
+
specify('#captain') { expect(recaps.captain.id).to eq '2935' }
|
20
|
+
specify('#players') { expect(recaps.players.first.id).to eq '1585' }
|
21
21
|
end
|
@@ -1,42 +1,42 @@
|
|
1
|
-
RSpec.describe ChgkRating::Collections::Teams do
|
2
|
-
subject do
|
3
|
-
VCR.use_cassette 'teams' do
|
4
|
-
described_class.new
|
5
|
-
end
|
6
|
-
end
|
7
|
-
let(:team) { subject[1] }
|
8
|
-
|
9
|
-
it_behaves_like 'not a hash'
|
10
|
-
it_behaves_like 'an array'
|
11
|
-
|
12
|
-
specify('#id') { expect(team.id).to eq '2' }
|
13
|
-
specify('#town') { expect(team.town).to eq 'Москва' }
|
14
|
-
specify('#name') { expect(team.name).to eq 'Афина' }
|
15
|
-
specify '#to_a' do
|
16
|
-
teams_arr = subject.to_a
|
17
|
-
expect(teams_arr.count).to eq 1000
|
18
|
-
expect(teams_arr[3]['idteam']).to eq '5'
|
19
|
-
end
|
20
|
-
|
21
|
-
context 'pagination' do
|
22
|
-
subject do
|
23
|
-
VCR.use_cassette 'teams_page3' do
|
24
|
-
described_class.new(page: 3)[1]
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
specify('#id') { expect(subject.id).to eq '2285' }
|
29
|
-
specify('#name') { expect(subject.name).to eq 'Эффект внезапности' }
|
30
|
-
end
|
31
|
-
|
32
|
-
context 'searching' do
|
33
|
-
subject do
|
34
|
-
VCR.use_cassette 'teams_searching' do
|
35
|
-
described_class.search(request: {name: 'э', town: 'мин'})[0]
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
specify('#id') { expect(subject.id).to eq '5444' }
|
40
|
-
specify('#name') { expect(subject.name).to eq 'Эйфью' }
|
41
|
-
end
|
1
|
+
RSpec.describe ChgkRating::Collections::Teams do
|
2
|
+
subject do
|
3
|
+
VCR.use_cassette 'teams' do
|
4
|
+
described_class.new
|
5
|
+
end
|
6
|
+
end
|
7
|
+
let(:team) { subject[1] }
|
8
|
+
|
9
|
+
it_behaves_like 'not a hash'
|
10
|
+
it_behaves_like 'an array'
|
11
|
+
|
12
|
+
specify('#id') { expect(team.id).to eq '2' }
|
13
|
+
specify('#town') { expect(team.town).to eq 'Москва' }
|
14
|
+
specify('#name') { expect(team.name).to eq 'Афина' }
|
15
|
+
specify '#to_a' do
|
16
|
+
teams_arr = subject.to_a
|
17
|
+
expect(teams_arr.count).to eq 1000
|
18
|
+
expect(teams_arr[3]['idteam']).to eq '5'
|
19
|
+
end
|
20
|
+
|
21
|
+
context 'pagination' do
|
22
|
+
subject do
|
23
|
+
VCR.use_cassette 'teams_page3' do
|
24
|
+
described_class.new(page: 3)[1]
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
specify('#id') { expect(subject.id).to eq '2285' }
|
29
|
+
specify('#name') { expect(subject.name).to eq 'Эффект внезапности' }
|
30
|
+
end
|
31
|
+
|
32
|
+
context 'searching' do
|
33
|
+
subject do
|
34
|
+
VCR.use_cassette 'teams_searching' do
|
35
|
+
described_class.search(request: {name: 'э', town: 'мин'})[0]
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
specify('#id') { expect(subject.id).to eq '5444' }
|
40
|
+
specify('#name') { expect(subject.name).to eq 'Эйфью' }
|
41
|
+
end
|
42
42
|
end
|
@@ -1,18 +1,18 @@
|
|
1
|
-
RSpec.describe ChgkRating::Collections::TournamentPlayers do
|
2
|
-
subject do
|
3
|
-
VCR.use_cassette 'team_players_at_tournament' do
|
4
|
-
described_class.new(tournament: 3506, team: 52853)
|
5
|
-
end
|
6
|
-
end
|
7
|
-
|
8
|
-
|
9
|
-
it_behaves_like 'tournament team player' do
|
10
|
-
let(:player) { subject[0] }
|
11
|
-
end
|
12
|
-
it_behaves_like 'not a hash'
|
13
|
-
it_behaves_like 'an array'
|
14
|
-
|
15
|
-
specify '#to_a' do
|
16
|
-
expect(subject.to_a[2]['idplayer']).to eq '51250'
|
17
|
-
end
|
1
|
+
RSpec.describe ChgkRating::Collections::TournamentPlayers do
|
2
|
+
subject do
|
3
|
+
VCR.use_cassette 'team_players_at_tournament' do
|
4
|
+
described_class.new(tournament: 3506, team: 52853)
|
5
|
+
end
|
6
|
+
end
|
7
|
+
|
8
|
+
|
9
|
+
it_behaves_like 'tournament team player' do
|
10
|
+
let(:player) { subject[0] }
|
11
|
+
end
|
12
|
+
it_behaves_like 'not a hash'
|
13
|
+
it_behaves_like 'an array'
|
14
|
+
|
15
|
+
specify '#to_a' do
|
16
|
+
expect(subject.to_a[2]['idplayer']).to eq '51250'
|
17
|
+
end
|
18
18
|
end
|
@@ -1,17 +1,17 @@
|
|
1
|
-
RSpec.describe ChgkRating::Collections::TournamentTeamResults do
|
2
|
-
subject do
|
3
|
-
VCR.use_cassette 'team_results_at_tournament' do
|
4
|
-
described_class.new(tournament: 3506, team: 52853)
|
5
|
-
end
|
6
|
-
end
|
7
|
-
|
8
|
-
it_behaves_like 'tournament team result' do
|
9
|
-
let(:team_result) { subject[0] }
|
10
|
-
end
|
11
|
-
it_behaves_like 'not a hash'
|
12
|
-
it_behaves_like 'an array'
|
13
|
-
|
14
|
-
specify '#to_a' do
|
15
|
-
expect(subject.to_a[2]['tour']).to eq '3'
|
16
|
-
end
|
1
|
+
RSpec.describe ChgkRating::Collections::TournamentTeamResults do
|
2
|
+
subject do
|
3
|
+
VCR.use_cassette 'team_results_at_tournament' do
|
4
|
+
described_class.new(tournament: 3506, team: 52853)
|
5
|
+
end
|
6
|
+
end
|
7
|
+
|
8
|
+
it_behaves_like 'tournament team result' do
|
9
|
+
let(:team_result) { subject[0] }
|
10
|
+
end
|
11
|
+
it_behaves_like 'not a hash'
|
12
|
+
it_behaves_like 'an array'
|
13
|
+
|
14
|
+
specify '#to_a' do
|
15
|
+
expect(subject.to_a[2]['tour']).to eq '3'
|
16
|
+
end
|
17
17
|
end
|
@@ -1,58 +1,60 @@
|
|
1
|
-
RSpec.describe ChgkRating::Collections::TournamentTeams do
|
2
|
-
subject do
|
3
|
-
VCR.use_cassette 'teams_at_tournament' do
|
4
|
-
described_class.new(tournament: 3506)
|
5
|
-
end
|
6
|
-
end
|
7
|
-
let(:team) { subject[0] }
|
8
|
-
let(:tournament_team_h) { team.to_h }
|
9
|
-
|
10
|
-
it_behaves_like 'not a hash'
|
11
|
-
it_behaves_like 'an array'
|
12
|
-
|
13
|
-
specify('#id') { expect(team.id).to eq '2124' }
|
14
|
-
specify('#current_name') { expect(team.current_name).to eq 'Полосатый мамонт' }
|
15
|
-
specify('#base_name') { expect(team.base_name).to eq 'Полосатый мамонт' }
|
16
|
-
specify('#position') { expect(team.position).to eq 3 }
|
17
|
-
specify('#questions_total') { expect(team.questions_total).to eq 34 }
|
18
|
-
specify('#bonus_a') { expect(team.bonus_a).to eq 1575 }
|
19
|
-
specify('#bonus_b') { expect(team.bonus_b).to eq -
|
20
|
-
specify('#tech_rating') { expect(team.tech_rating).to eq
|
21
|
-
specify('#predicted_position') { expect(team.predicted_position).to eq 2 }
|
22
|
-
specify('#
|
23
|
-
specify('#d_bonus_b') { expect(team.d_bonus_b).to eq
|
24
|
-
specify('#
|
25
|
-
specify('#
|
26
|
-
|
27
|
-
true, true,
|
28
|
-
true, true,
|
29
|
-
true, true,
|
30
|
-
true, true, false,
|
31
|
-
|
32
|
-
false, true, true, true, true
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
expect(tournament_team_h['
|
42
|
-
expect(tournament_team_h['
|
43
|
-
expect(tournament_team_h['
|
44
|
-
|
45
|
-
"
|
46
|
-
"
|
47
|
-
"1", "1", "1", "1"
|
48
|
-
|
49
|
-
expect(tournament_team_h['
|
50
|
-
expect(tournament_team_h['
|
51
|
-
expect(tournament_team_h['
|
52
|
-
expect(tournament_team_h['
|
53
|
-
expect(tournament_team_h['d_bonus_b']).to eq '
|
54
|
-
expect(tournament_team_h['
|
55
|
-
expect(tournament_team_h['
|
56
|
-
expect(tournament_team_h['
|
57
|
-
|
1
|
+
RSpec.describe ChgkRating::Collections::TournamentTeams do
|
2
|
+
subject do
|
3
|
+
VCR.use_cassette 'teams_at_tournament' do
|
4
|
+
described_class.new(tournament: 3506)
|
5
|
+
end
|
6
|
+
end
|
7
|
+
let(:team) { subject[0] }
|
8
|
+
let(:tournament_team_h) { team.to_h }
|
9
|
+
|
10
|
+
it_behaves_like 'not a hash'
|
11
|
+
it_behaves_like 'an array'
|
12
|
+
|
13
|
+
specify('#id') { expect(team.id).to eq '2124' }
|
14
|
+
specify('#current_name') { expect(team.current_name).to eq 'Полосатый мамонт' }
|
15
|
+
specify('#base_name') { expect(team.base_name).to eq 'Полосатый мамонт' }
|
16
|
+
specify('#position') { expect(team.position).to eq 3 }
|
17
|
+
specify('#questions_total') { expect(team.questions_total).to eq 34 }
|
18
|
+
specify('#bonus_a') { expect(team.bonus_a).to eq 1575 }
|
19
|
+
specify('#bonus_b') { expect(team.bonus_b).to eq -47 }
|
20
|
+
specify('#tech_rating') { expect(team.tech_rating).to eq 2549 }
|
21
|
+
specify('#predicted_position') { expect(team.predicted_position).to eq 2 }
|
22
|
+
specify('#d_bonus_a') { expect(team.d_bonus_a).to eq 1575 }
|
23
|
+
specify('#d_bonus_b') { expect(team.d_bonus_b).to eq 420 }
|
24
|
+
specify('#d_diff_bonus') { expect(team.d_diff_bonus).to eq -47 }
|
25
|
+
specify('#included_in_rating') { expect(team.included_in_rating).to eq true }
|
26
|
+
specify('#result') { expect(team.result).to eq [true, true, true, false, true, true,
|
27
|
+
true, true, true, true, true,
|
28
|
+
true, true, false, false, false, false,
|
29
|
+
true, true, true, true, true, false, true,
|
30
|
+
true, true, false, false, true, false,
|
31
|
+
true, true, false, true, true, false, true,
|
32
|
+
false, true, false, true, true, true,
|
33
|
+
false, true, true, true, true] }
|
34
|
+
|
35
|
+
specify '#to_a' do
|
36
|
+
expect(subject.to_a[2]['idteam']).to eq '28434'
|
37
|
+
end
|
38
|
+
|
39
|
+
# to_h for a fully loaded model
|
40
|
+
specify '#to_h for a model' do
|
41
|
+
expect(tournament_team_h['idteam']).to eq '2124'
|
42
|
+
expect(tournament_team_h['position']).to eq '3.0'
|
43
|
+
expect(tournament_team_h['questions_total']).to eq '34'
|
44
|
+
expect(tournament_team_h['mask']).to eq ["1", "1", "1", "0", "1", "1", "1", "1", "1", "1", "1",
|
45
|
+
"1", "1", "0", "0", "0", "0", "1", "1", "1", "1", "1",
|
46
|
+
"0", "1", "1", "1", "0", "0", "1", "0", "1", "1", "0",
|
47
|
+
"1", "1", "0", "1", "0", "1", "0", "1", "1", "1", "0",
|
48
|
+
"1", "1", "1", "1"]
|
49
|
+
expect(tournament_team_h['bonus_a']).to eq '1575'
|
50
|
+
expect(tournament_team_h['bonus_b']).to eq '-47'
|
51
|
+
expect(tournament_team_h['tech_rating']).to eq '2549'
|
52
|
+
expect(tournament_team_h['d_bonus_a']).to eq '1575'
|
53
|
+
expect(tournament_team_h['d_bonus_b']).to eq '420'
|
54
|
+
expect(tournament_team_h['d_diff_bonus']).to eq '-47'
|
55
|
+
expect(tournament_team_h['predicted_position']).to eq '2'
|
56
|
+
expect(tournament_team_h['included_in_rating']).to eq '1'
|
57
|
+
expect(tournament_team_h['current_name']).to eq 'Полосатый мамонт'
|
58
|
+
expect(tournament_team_h['base_name']).to eq 'Полосатый мамонт'
|
59
|
+
end
|
58
60
|
end
|