csstats 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.rubocop.yml +33 -0
- data/.travis.yml +23 -7
- data/Gemfile +3 -7
- data/LICENSE +1 -1
- data/README.md +12 -9
- data/bin/console +1 -1
- data/csstats.gemspec +3 -4
- data/lib/csstats.rb +5 -3
- data/lib/csstats/client.rb +23 -0
- data/lib/csstats/columns.rb +28 -0
- data/lib/csstats/parser.rb +13 -4
- data/lib/csstats/parser/reader.rb +11 -0
- data/lib/csstats/parser/reader/file_reader.rb +45 -0
- data/lib/csstats/parser/{file_reader/handler.rb → reader/file_streamer.rb} +8 -8
- data/lib/csstats/parser/reader/player.rb +41 -0
- data/lib/csstats/parser/reader/players.rb +41 -0
- data/lib/csstats/{writer.rb → parser/writer.rb} +4 -2
- data/lib/csstats/{writer/file_writer/handler.rb → parser/writer/file_streamer.rb} +9 -10
- data/lib/csstats/parser/writer/player.rb +34 -0
- data/lib/csstats/parser/writer/players.rb +29 -0
- data/lib/csstats/player.rb +34 -0
- data/lib/csstats/players.rb +52 -0
- data/lib/csstats/version.rb +1 -1
- data/spec/csstats/client_spec.rb +13 -0
- data/spec/csstats/parser/reader/player_spec.rb +17 -0
- data/spec/csstats/parser/writer/players_spec.rb +30 -0
- data/spec/csstats/player_spec.rb +109 -0
- data/spec/csstats/players_spec.rb +30 -0
- data/spec/csstats_spec.rb +2 -2
- data/spec/spec_helper.rb +3 -7
- metadata +29 -21
- data/lib/csstats/handler.rb +0 -50
- data/lib/csstats/parser/file_reader.rb +0 -39
- data/lib/csstats/parser/player.rb +0 -82
- data/lib/csstats/parser/players.rb +0 -42
- data/lib/csstats/writer/player.rb +0 -39
- data/lib/csstats/writer/players.rb +0 -24
- data/spec/csstats/handler_spec.rb +0 -113
- data/spec/csstats/parser/player_spec.rb +0 -17
- data/spec/csstats/writer/players_spec.rb +0 -26
@@ -1,17 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe CSstats::Parser::Player do
|
4
|
-
let(:file_stream) { File.new(csstats_file) }
|
5
|
-
let(:handler) { CSstats::Parser::FileReader::Handler.new(file_stream) }
|
6
|
-
subject { described_class.new }
|
7
|
-
let(:player_data) { subject.parse(handler) }
|
8
|
-
|
9
|
-
before do
|
10
|
-
# We need to read first bytes, because it's file version.
|
11
|
-
handler.read_short_data
|
12
|
-
end
|
13
|
-
|
14
|
-
it 'has correct acc' do
|
15
|
-
expect(player_data.acc).to eq(24.3)
|
16
|
-
end
|
17
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe CSstats::Writer::Players do
|
4
|
-
let(:old_players) { CSstats::Handler.new(path: csstats_file).players }
|
5
|
-
let(:file_path) { tmp_file('test.dat') }
|
6
|
-
let(:new_players) { CSstats::Handler.new(path: file_path).players }
|
7
|
-
|
8
|
-
it 'has correct players count in main file' do
|
9
|
-
expect(old_players.length).to eq(208)
|
10
|
-
end
|
11
|
-
|
12
|
-
context 'new file' do
|
13
|
-
before do
|
14
|
-
CSstats::Writer::Players.new(old_players).write(file_path)
|
15
|
-
end
|
16
|
-
|
17
|
-
it 'has correct players count' do
|
18
|
-
CSstats::Writer::Players.new(old_players).write(file_path)
|
19
|
-
expect(new_players.length).to eq(208)
|
20
|
-
end
|
21
|
-
|
22
|
-
it 'has same players data' do
|
23
|
-
expect(old_players).to eq(new_players)
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|