csstats 1.2.0 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: eea82615b3acd8120d7a37421c4a8dc927d7fb287b87dc7114398081bb37c6ed
4
- data.tar.gz: 06f4df73a2c9be3f1f966c5b92db657c635741b2ebfd6d31940a917777e9bc99
3
+ metadata.gz: 36138e290db85a546d2c969e1528b1a7f9ef810361cd9031993b56dbf5398663
4
+ data.tar.gz: fc94d9da4bac767e5e9323b18879a803be41e95652f88e77d697eaf4905653f8
5
5
  SHA512:
6
- metadata.gz: d6209408d58fcf60f9f4627f85f8f9a1683b059e3cdfe1501bf10ab740d6a1ff742d1a2587564314a690476719608fd9ce9bba902016d33308399abc816c5b32
7
- data.tar.gz: 6adbfb5ebf1396f25b0e50741b4591381332701c8de674e759f738e11c6605716c4a57897b950fe1f364035a96042053a7bb00f7e2f38755098e6c3981f05d64
6
+ metadata.gz: c185f7385b2c62ed15cb3ad6ac4a158a0469257f7bfbb0a84b7bb3e1b4994e22c884047604492f47d60723c24a95ad2147b30595d2655a74754661ddb88c55d3
7
+ data.tar.gz: a35903eaff534d5c89de73832093069c2fad243aab56ccd106cc93c3e1b78b897ef4caf642190beb8e8bac784cbb87c4452ab8a21935f41402c5476ca19d0c61
@@ -0,0 +1,28 @@
1
+ name: Test
2
+
3
+ on: [push]
4
+
5
+ jobs:
6
+ test:
7
+ strategy:
8
+ matrix:
9
+ ruby: [2.4, 2.5, 2.6]
10
+
11
+ runs-on: ubuntu-latest
12
+
13
+ steps:
14
+ - name: Checkout
15
+ uses: actions/checkout@v1
16
+ - name: Set up Ruby ${{ matrix.ruby }}
17
+ uses: actions/setup-ruby@v1
18
+ with:
19
+ ruby-version: ${{ matrix.ruby }}
20
+ - name: Install dependencies
21
+ run: |
22
+ gem install bundler
23
+ bundle install --jobs 4 --retry 3
24
+ - name: Test
25
+ env:
26
+ CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
27
+ run: |
28
+ bundle exec rspec
@@ -1,8 +1,5 @@
1
1
  AllCops:
2
- TargetRubyVersion: 2.1
3
- Include:
4
- - '**/Rakefile'
5
- - '**/Gemfile'
2
+ TargetRubyVersion: 2.4
6
3
 
7
4
  Layout/AlignParameters:
8
5
  Enabled: true
@@ -24,9 +21,6 @@ Layout/EndAlignment:
24
21
  Enabled: true
25
22
  EnforcedStyleAlignWith: variable
26
23
 
27
- Style/FrozenStringLiteralComment:
28
- Enabled: false
29
-
30
24
  Style/Documentation:
31
25
  Enabled: false
32
26
 
data/Gemfile CHANGED
@@ -1,7 +1,9 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  group :development do
4
- gem 'rubocop', '~> 0.53'
6
+ gem 'rubocop', '~> 0.76'
5
7
  end
6
8
 
7
9
  group :development, :test do
@@ -9,8 +11,9 @@ group :development, :test do
9
11
  end
10
12
 
11
13
  group :test do
12
- gem 'rspec', '~> 3.7'
13
- gem 'simplecov', '~> 0.15', require: false
14
+ gem 'codecov', require: false
15
+ gem 'rspec', '~> 3.9'
16
+ gem 'simplecov', '~> 0.17', require: false
14
17
  end
15
18
 
16
19
  gemspec
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2018 Justas Palumickas
3
+ Copyright (c) 2019 Justas Palumickas
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -1,27 +1,18 @@
1
1
  # CSstats
2
2
 
3
- [![Gem Version](https://img.shields.io/gem/v/csstats.svg?style=flat-square)][rubygems]
4
- [![Build Status](https://img.shields.io/travis/jpalumickas/csstats.svg?style=flat-square)][travis]
5
- [![Dependency Status](https://img.shields.io/gemnasium/jpalumickas/csstats.svg?style=flat-square)][gemnasium]
6
- [![Code Climate](https://img.shields.io/codeclimate/maintainability/jpalumickas/csstats.svg?style=flat-square)][codeclimate]
7
- [![Test Coverage](https://img.shields.io/codeclimate/c/jpalumickas/csstats.svg?style=flat-square)][codeclimate_coverage]
8
-
9
3
  Gem which handle `csstats.dat` file generated by CSX module
10
- in AMX Mod X ([http://www.amxmodx.org/][amxx])
4
+ in AMX Mod X ([https://www.amxmodx.org][amxx])
5
+
6
+ [![Gem Version](https://img.shields.io/gem/v/csstats.svg?style=flat-square)][rubygems]
7
+ [![Coverage Status](https://img.shields.io/codecov/c/github/jpalumickas/csstats?style=flat-square)][codecov]
11
8
 
12
9
  ## Installation
13
10
 
14
11
  Add this line to your application's Gemfile:
15
12
 
16
- gem 'csstats'
17
-
18
- And then execute:
19
-
20
- $ bundle
21
-
22
- Or install it yourself as:
23
-
24
- $ gem install csstats
13
+ ```ruby
14
+ gem 'csstats'
15
+ ```
25
16
 
26
17
  ## Usage
27
18
 
@@ -52,25 +43,20 @@ puts player_stats.kills
52
43
 
53
44
  ## Supported Ruby Versions
54
45
 
55
- This library aims to support and is [tested against][travis] the following Ruby
46
+ This library aims to support and is [tested against][github_actions] the following Ruby
56
47
  implementations:
57
48
 
58
- * Ruby 2.1.0
59
- * Ruby 2.2.0
60
- * Ruby 2.3.0
61
49
  * Ruby 2.4.0
62
50
  * Ruby 2.5.0
51
+ * Ruby 2.6.0
63
52
 
64
53
  ## Copyright
65
- Copyright (c) 2013-2018 Justas Palumickas.
54
+ Copyright (c) 2013-2019 Justas Palumickas.
66
55
  See [LICENSE][license] for details.
67
56
 
68
57
  [rubygems]: https://rubygems.org/gems/csstats
69
- [travis]: http://travis-ci.org/jpalumickas/csstats
70
- [gemnasium]: https://gemnasium.com/jpalumickas/csstats
71
- [coveralls]: https://coveralls.io/r/jpalumickas/csstats
72
- [codeclimate]: https://codeclimate.com/github/jpalumickas/csstats
73
- [codeclimate_coverage]: https://codeclimate.com/github/jpalumickas/csstats/test_coverage
58
+ [codecov]: https://codecov.io/gh/jpalumickas/csstats
59
+ [github_actions]: https://github.com/jpalumickas/csstats/actions
74
60
 
75
- [amxx]: http://www.amxmodx.org/
61
+ [amxx]: https://www.amxmodx.org
76
62
  [license]: https://raw.githubusercontent.com/jpalumickas/csstats/master/LICENSE
data/Rakefile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'bundler'
2
4
  Bundler::GemHelper.install_tasks
3
5
 
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
4
  require 'bundler/setup'
4
5
  require 'csstats'
@@ -1,25 +1,41 @@
1
+ # frozen_string_literal: true
2
+
1
3
  lib = File.expand_path('lib', __dir__)
2
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
5
  require 'csstats/version'
4
6
 
5
- Gem::Specification.new do |gem|
6
- gem.name = 'csstats'
7
- gem.version = CSstats::VERSION
8
- gem.author = 'Justas Palumickas'
9
- gem.email = 'jpalumickas@gmail.com'
10
- gem.homepage = 'https://github.com/jpalumickas/csstats/'
11
- gem.summary = gem.description
12
- gem.description = 'Gem which handle csstats.dat file generated by CSX' \
13
- ' module in AMX Mod X (http://www.amxmodx.org/)'
7
+ github_repo_url = 'https://github.com/jpalumickas/csstats'
14
8
 
15
- gem.license = 'MIT'
16
- gem.required_ruby_version = '>= 2.1.0'
9
+ Gem::Specification.new do |spec|
10
+ spec.name = 'csstats'
11
+ spec.version = CSstats::VERSION
12
+ spec.author = 'Justas Palumickas'
13
+ spec.email = 'jpalumickas@gmail.com'
14
+
15
+ spec.summary = spec.description
16
+ spec.description = 'Gem which handle csstats.dat file generated by CSX' \
17
+ ' module in AMX Mod X (http://www.amxmodx.org/)'
18
+ spec.homepage = github_repo_url
19
+ spec.license = 'MIT'
20
+ spec.metadata = {
21
+ 'bug_tracker_uri' => "#{github_repo_url}/issues",
22
+ 'source_code_uri' => "#{github_repo_url}/tree/v#{CSstats::VERSION}",
23
+ 'changelog_uri' => "#{github_repo_url}/releases/tag/v#{CSstats::VERSION}"
24
+ }
17
25
 
18
- gem.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
19
- gem.executables = gem.files.grep(%r{^bin\/}).map { |f| File.basename(f) }
20
- gem.test_files = gem.files.grep(%r{^(test|spec|features)\/})
21
- gem.require_paths = ['lib']
26
+ # Specify which files should be added to the gem when it is released.
27
+ # The `git ls-files -z` loads the files in the RubyGem that have been added
28
+ # into git.
29
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
30
+ `git ls-files -z`.split("\x0").reject do |f|
31
+ f.match(%r{^(test|spec|features)/})
32
+ end
33
+ end
34
+ spec.bindir = 'exe'
35
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
36
+ spec.require_paths = ['lib']
37
+ spec.required_ruby_version = '>= 2.4.0'
22
38
 
23
- gem.add_dependency 'hashie', '~> 3.4'
24
- gem.add_development_dependency 'bundler', '~> 1.16'
39
+ spec.add_dependency 'hashie', '~> 3.5'
40
+ spec.add_development_dependency 'bundler', '~> 2.0'
25
41
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'csstats/columns'
2
4
  require 'csstats/error'
3
5
  require 'csstats/player'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module CSstats
2
4
  class Client
3
5
  attr_reader :file_path, :max_players
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module CSstats
2
4
  COLUMNS = [
3
5
  { name: :nick, type: :string },
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module CSstats
2
4
  class Error < StandardError; end
3
5
  class FileNotExist < StandardError; end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'parser/reader'
2
4
  require_relative 'parser/writer'
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'reader/file_streamer'
2
4
  require_relative 'reader/file_reader'
3
5
  require_relative 'reader/player'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'file_streamer'
2
4
 
3
5
  module CSstats
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module CSstats
2
4
  module Parser
3
5
  module Reader
@@ -15,7 +17,7 @@ module CSstats
15
17
  data = stream.read(4)
16
18
  raise CSstats::Error, 'Cannot read int data.' unless data
17
19
 
18
- data.unpack('V').first
20
+ data.unpack1('V')
19
21
  end
20
22
 
21
23
  # Internal: Get the 16bit integer from file.
@@ -25,7 +27,7 @@ module CSstats
25
27
  data = stream.read(2)
26
28
  raise CSstats::Error, 'Cannot read short data.' unless data
27
29
 
28
- data.unpack('v').first
30
+ data.unpack1('v')
29
31
  end
30
32
 
31
33
  # Internal: Get the String from file.
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module CSstats
2
4
  module Parser
3
5
  module Reader
@@ -12,6 +14,7 @@ module CSstats
12
14
  player = CSstats::Player.new
13
15
  parse_columns(player)
14
16
  return unless player.nick
17
+
15
18
  player
16
19
  end
17
20
 
@@ -29,6 +32,7 @@ module CSstats
29
32
  def parse_string
30
33
  length = stream.read_short_data
31
34
  return if length.zero?
35
+
32
36
  stream.read_string_data(length)
33
37
  end
34
38
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module CSstats
2
4
  module Parser
3
5
  module Reader
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'writer/file_streamer'
2
4
  require_relative 'writer/player'
3
5
  require_relative 'writer/players'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module CSstats
2
4
  module Parser
3
5
  module Writer
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module CSstats
2
4
  module Parser
3
5
  module Writer
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module CSstats
2
4
  module Parser
3
5
  module Writer
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module CSstats
2
4
  class Player
3
5
  attr_accessor :rank
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module CSstats
2
4
  class Players
3
5
  attr_reader :client
@@ -36,6 +38,7 @@ module CSstats
36
38
 
37
39
  def method_missing(method_name, *args, &block)
38
40
  return super unless respond_to?(method_name)
41
+
39
42
  players.send(method_name, *args, &block)
40
43
  end
41
44
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module CSstats
2
- VERSION = '1.2.0'.freeze
4
+ VERSION = '1.3.0'
3
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: csstats
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justas Palumickas
8
8
  autorequire:
9
- bindir: bin
9
+ bindir: exe
10
10
  cert_chain: []
11
- date: 2018-03-12 00:00:00.000000000 Z
11
+ date: 2019-10-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: hashie
@@ -16,41 +16,40 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '3.4'
19
+ version: '3.5'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '3.4'
26
+ version: '3.5'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '1.16'
33
+ version: '2.0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '1.16'
40
+ version: '2.0'
41
41
  description: Gem which handle csstats.dat file generated by CSX module in AMX Mod
42
42
  X (http://www.amxmodx.org/)
43
43
  email: jpalumickas@gmail.com
44
- executables:
45
- - console
44
+ executables: []
46
45
  extensions: []
47
46
  extra_rdoc_files: []
48
47
  files:
48
+ - ".github/workflows/test.yml"
49
49
  - ".gitignore"
50
50
  - ".hound.yml"
51
51
  - ".rspec"
52
52
  - ".rubocop.yml"
53
- - ".travis.yml"
54
53
  - CONTRIBUTING.md
55
54
  - Gemfile
56
55
  - LICENSE
@@ -75,19 +74,13 @@ files:
75
74
  - lib/csstats/player.rb
76
75
  - lib/csstats/players.rb
77
76
  - lib/csstats/version.rb
78
- - spec/csstats/client_spec.rb
79
- - spec/csstats/parser/reader/player_spec.rb
80
- - spec/csstats/parser/writer/players_spec.rb
81
- - spec/csstats/player_spec.rb
82
- - spec/csstats/players_spec.rb
83
- - spec/csstats_spec.rb
84
- - spec/fixtures/csstats.dat
85
- - spec/spec_helper.rb
86
- - spec/tmp/.keep
87
- homepage: https://github.com/jpalumickas/csstats/
77
+ homepage: https://github.com/jpalumickas/csstats
88
78
  licenses:
89
79
  - MIT
90
- metadata: {}
80
+ metadata:
81
+ bug_tracker_uri: https://github.com/jpalumickas/csstats/issues
82
+ source_code_uri: https://github.com/jpalumickas/csstats/tree/v1.3.0
83
+ changelog_uri: https://github.com/jpalumickas/csstats/releases/tag/v1.3.0
91
84
  post_install_message:
92
85
  rdoc_options: []
93
86
  require_paths:
@@ -96,25 +89,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
96
89
  requirements:
97
90
  - - ">="
98
91
  - !ruby/object:Gem::Version
99
- version: 2.1.0
92
+ version: 2.4.0
100
93
  required_rubygems_version: !ruby/object:Gem::Requirement
101
94
  requirements:
102
95
  - - ">="
103
96
  - !ruby/object:Gem::Version
104
97
  version: '0'
105
98
  requirements: []
106
- rubyforge_project:
107
- rubygems_version: 2.7.6
99
+ rubygems_version: 3.0.6
108
100
  signing_key:
109
101
  specification_version: 4
110
102
  summary: ''
111
- test_files:
112
- - spec/csstats/client_spec.rb
113
- - spec/csstats/parser/reader/player_spec.rb
114
- - spec/csstats/parser/writer/players_spec.rb
115
- - spec/csstats/player_spec.rb
116
- - spec/csstats/players_spec.rb
117
- - spec/csstats_spec.rb
118
- - spec/fixtures/csstats.dat
119
- - spec/spec_helper.rb
120
- - spec/tmp/.keep
103
+ test_files: []
@@ -1,36 +0,0 @@
1
- sudo: false
2
- bundler_args: --without development
3
-
4
- cache:
5
- bundler: true
6
-
7
- env:
8
- global:
9
- - CC_TEST_REPORTER_ID=b17eed44b7f9100d09d50eb58b2b4e7272022e7245676d04dd30378f69eba6dd
10
-
11
- language: ruby
12
- rvm:
13
- - 2.1.0
14
- - 2.2.0
15
- - 2.3.0
16
- - 2.4.0
17
- - 2.5.0
18
- - ruby-head
19
-
20
- before_install:
21
- - gem update --system
22
-
23
- before_script:
24
- - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
25
- - chmod +x ./cc-test-reporter
26
- - ./cc-test-reporter before-build
27
-
28
- script:
29
- - bundle exec rspec
30
-
31
- after_script:
32
- - ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
33
-
34
- matrix:
35
- allow_failures:
36
- - rvm: ruby-head
@@ -1,13 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe CSstats::Client do
4
- let(:client) { CSstats::Client.new(path: csstats_file, max_players: 5) }
5
-
6
- it 'has correct file path' do
7
- expect(client.file_path).to eq(csstats_file)
8
- end
9
-
10
- it 'has correct max players value' do
11
- expect(client.max_players).to eq(5)
12
- end
13
- end
@@ -1,17 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe CSstats::Parser::Reader::Player do
4
- let(:file_stream) { File.new(csstats_file) }
5
- let(:streamer) { CSstats::Parser::Reader::FileStreamer.new(file_stream) }
6
- subject { described_class.new(streamer) }
7
- let(:player_data) { subject.parse }
8
-
9
- before do
10
- # We need to read first bytes, because it's file version.
11
- streamer.read_short_data
12
- end
13
-
14
- it 'has correct head' do
15
- expect(player_data.head).to eq(402)
16
- end
17
- end
@@ -1,30 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe CSstats::Parser::Writer::Players do
4
- let(:old_players) { CSstats.new(path: csstats_file).players }
5
- let(:file_path) { tmp_file('test.dat') }
6
- let(:new_players) { CSstats.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
- described_class.new(file_path).write(old_players)
15
- end
16
-
17
- after do
18
- FileUtils.rm(file_path)
19
- end
20
-
21
- it 'has correct players count' do
22
- described_class.new(file_path).write(old_players)
23
- expect(new_players.length).to eq(208)
24
- end
25
-
26
- it 'has same players data' do
27
- expect(old_players.map(&:as_json)).to eq(new_players.map(&:as_json))
28
- end
29
- end
30
- end
@@ -1,109 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe CSstats::Player do
4
- let(:client) { CSstats::Client.new(path: csstats_file, max_players: 10) }
5
- let(:players) { client.players }
6
-
7
- it 'sets attributes from options' do
8
- player = CSstats::Player.new(nick: 'Test')
9
- expect(player.nick).to eq('Test')
10
- end
11
-
12
- it 'has ability to rewrite attribute' do
13
- player = CSstats::Player.new
14
- player.nick = 'Test'
15
- expect(player.nick).to eq('Test')
16
- end
17
-
18
- context 'data' do
19
- let(:player) { players.find_by(nick: 'CHMARSON') }
20
-
21
- it 'has correct nick' do
22
- expect(player.nick).to eq 'CHMARSON'
23
- end
24
-
25
- it 'has correct rank' do
26
- expect(player.rank).to eq 2
27
- end
28
-
29
- it 'has correct teamkill' do
30
- expect(player.teamkill).to eq 7
31
- end
32
-
33
- it 'has correct damage' do
34
- expect(player.damage).to eq 101_543
35
- end
36
-
37
- it 'has correct deaths' do
38
- expect(player.deaths).to eq 511
39
- end
40
-
41
- it 'has correct kills' do
42
- expect(player.kills).to eq 759
43
- end
44
-
45
- it 'has correct shots' do
46
- expect(player.shots).to eq 9421
47
- end
48
-
49
- it 'has correct hits' do
50
- expect(player.hits).to eq 2885
51
- end
52
-
53
- it 'has correct headshots' do
54
- expect(player.headshots).to eq 225
55
- end
56
-
57
- it 'has correct defusions' do
58
- expect(player.defusions).to eq 15
59
- end
60
-
61
- it 'has correct defused' do
62
- expect(player.defused).to eq 9
63
- end
64
-
65
- it 'has correct plants' do
66
- expect(player.plants).to eq 33
67
- end
68
-
69
- it 'has correct explosions' do
70
- expect(player.explosions).to eq 7
71
- end
72
-
73
- it 'has correct head' do
74
- expect(player.head).to eq 275
75
- end
76
-
77
- it 'has correct chest' do
78
- expect(player.chest).to eq 407
79
- end
80
-
81
- it 'has correct stomach' do
82
- expect(player.stomach).to eq 376
83
- end
84
-
85
- it 'has correct leftarm' do
86
- expect(player.leftarm).to eq 1126
87
- end
88
-
89
- it 'has correct rightarm' do
90
- expect(player.rightarm).to eq 283
91
- end
92
-
93
- it 'has correct leftleg' do
94
- expect(player.leftleg).to eq 202
95
- end
96
-
97
- it 'has correct rightleg' do
98
- expect(player.rightleg).to eq 214
99
- end
100
-
101
- it 'has correct accuracy' do
102
- expect(player.accuracy).to eq 30.62
103
- end
104
-
105
- it 'has correct efficiency' do
106
- expect(player.efficiency).to eq 59.76
107
- end
108
- end
109
- end
@@ -1,30 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe CSstats::Players do
4
- let(:client) { CSstats::Client.new(path: csstats_file, max_players: 30) }
5
- let(:players) { client.players }
6
-
7
- it 'has correct players count' do
8
- expect(players.count).to eq(30)
9
- end
10
-
11
- it 'returns players with all' do
12
- expect(players.all.length).to eq(30)
13
- end
14
-
15
- it 'has array of Player class' do
16
- expect(players.first).to be_a(CSstats::Player)
17
- end
18
-
19
- it 'has correct player data' do
20
- expect(players.find(2).nick).to eq('CHMARSON')
21
- end
22
-
23
- it 'has correct count with where' do
24
- expect(players.where(head: 102).count).to eq(2)
25
- end
26
-
27
- it 'has correct count with find_by' do
28
- expect(players.find_by(head: 102).nick).to eq('LBM')
29
- end
30
- end
@@ -1,13 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe CSstats do
4
- describe '.new' do
5
- it 'is a CSstats::Client' do
6
- expect(CSstats.new(path: csstats_file)).to be_a(CSstats::Client)
7
- end
8
-
9
- it 'is a CSstats::FileNotFound if file path empty' do
10
- expect { CSstats.new }.to raise_error(CSstats::FileNotExist)
11
- end
12
- end
13
- end
Binary file
@@ -1,30 +0,0 @@
1
- require 'simplecov'
2
-
3
- SimpleCov.formatters = [
4
- SimpleCov::Formatter::HTMLFormatter
5
- ]
6
-
7
- SimpleCov.start
8
-
9
- require 'csstats'
10
- require 'rspec'
11
-
12
- RSpec.configure do |config|
13
- config.expect_with :rspec do |c|
14
- c.syntax = :expect
15
- end
16
- end
17
-
18
- def csstats_file
19
- fixture_file('csstats.dat')
20
- end
21
-
22
- def fixture_file(filename)
23
- fixtures = File.expand_path('fixtures', __dir__)
24
- File.join(fixtures, filename)
25
- end
26
-
27
- def tmp_file(filename)
28
- tmps = File.expand_path('tmp', __dir__)
29
- File.join(tmps, filename)
30
- end