sys-cpu 0.8.0 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: de4fef13495a9b0d229eea6796851de82b4ccadc4a8e45dcea91b42d9f6ec074
4
- data.tar.gz: 6da5868da52f3237d14d42a9a8823292711687957da05bda73136e7936f6946d
3
+ metadata.gz: ff79a5d15ea499890892863713cf8b78d1e827f8d78e9baa3e637cea4aa1e732
4
+ data.tar.gz: e6d43e161f5f990cf6b5e7a3270ee3037eb052496b8712d1bbe4fc3e06a19f38
5
5
  SHA512:
6
- metadata.gz: 07ec871287015c0bb7ab832e7c679156e83d26a48eb78d27258799c301c3e33626496eb6519efe487f206bb3e2239845ba1a405b4050847f2b7099f9d9f79eec
7
- data.tar.gz: dfaa9832d07510d6bea73c8a775404362fa09c3fe945e88331d0486e7be707db0bd756c128350fac4d9fcbf668b3f0e54fca3f295df2f940d93e974684bf530a
6
+ metadata.gz: f23ba676b4100b4c8f2c01413965d9ffb67ed19746cf017dab2ece8cc5fb31b460fc04d75180dc4c5da647ee8e48934777d05720023e03e2aeb93213543458fe
7
+ data.tar.gz: 5c0b800fb4a1097f775378120775987c7b86a05728d68882b08432cd1b443ffc36b717360f6486797c091959c0b9102316f3967ab62fd297db1af679d3b83e08
Binary file
data.tar.gz.sig CHANGED
@@ -1,5 +1 @@
1
- g�ն³}2s6G���X*y�����Ӷ���1�a�fN/f��ѦV��ʐ���f=2����wбk��-.|.L���u��
2
- ��1u�.����&7�*��o.�#������3#}�6��ۊ�T�8�=�f9r�|o�aS��7��'�ԍ��uy�1a��G�]�a�MB��B[=�Z�y#�'�m��|��<�{}�x<&c�9na�T�u��r��,����(���c:�
3
- {c��S����Q��A�j"q�.B^6�na �����(�^+2��!^��/j���*���.�
4
- � >8��c�
5
- I&�rY����[i�����pOSOS�s1��y����}cQ-��+6�?��5u�@i��%��C6��ZA�&[
1
+ +:su��vuHA;&�4K�ж��xԭ�H��j8����g7u�z�,����C�+Q7&C\r��QW�\��i��FrR�uL=�N� \Hړ^��1���SG���6���Ô�/AafG����>Ìe�Jg�S^9�=�4��N�a��݈� �� 4!�U�xh�22��N
@@ -1,3 +1,27 @@
1
+ == 1.0.0 - 23-Oct-2020
2
+ * Fixed a bug in the Windows version where the attempt to convert the ConfigManagerErrorCode
3
+ to a string was busted. Coincidentally, this also exposed a core bug in JRuby (see PR #6443).
4
+ Thanks go to G. Gibson for reporting the issue.
5
+ * Switched the tests from test-unit to rspec.
6
+
7
+ == 0.9.0 - 12-May-2020
8
+ * Added explicit freq, architecture, num_cpu and model methods to the Linux
9
+ version in an effort to create a common interface across platforms.
10
+ * Modified the Linux version so that method_missing will raise a NoMethodError
11
+ if you try to call access an attribute that doesn't exist.
12
+ * Some updates to the Linux tests.
13
+
14
+ == 0.8.3 - 18-Mar-2020
15
+ * Properly include a LICENSE file as per the Apache-2.0 license.
16
+
17
+ == 0.8.2 - 14-Jan-2020
18
+ * Added explicit .rdoc extension to README, CHANGES and MANIFEST files.
19
+ * Fixed license name in README.
20
+
21
+ == 0.8.1 - 4-Nov-2018
22
+ * Added metadata to the gemspec.
23
+ * Fixed missing hyphen in license name.
24
+
1
25
  == 0.8.0 - 17-Oct-2018
2
26
  * Switched license to Apache 2.0.
3
27
  * Updated documentation for the cpu_stats method on Linux.
data/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ source 'https://rubygems.org' do
2
+ gem 'ffi', '~> 1.1'
3
+ group 'test' do
4
+ gem 'rake'
5
+ gem 'rspec', '~> 3.9'
6
+ end
7
+ end
data/LICENSE ADDED
@@ -0,0 +1,177 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
@@ -1,8 +1,9 @@
1
1
  * install.rb
2
- * MANIFEST
3
- * CHANGES
2
+ * LICENSE
3
+ * MANIFEST.rdoc
4
+ * CHANGES.rdoc
4
5
  * Rakefile
5
- * README
6
+ * README.rdoc
6
7
  * sys-cpu.gemspec
7
8
  * certs/djberg96_pub.pem
8
9
  * doc/bsd.txt
@@ -19,9 +20,10 @@
19
20
  * lib/sys/linux/sys/cpu.rb
20
21
  * lib/sys/unix/sys/cpu.rb
21
22
  * lib/sys/windows/sys/cpu.rb
22
- * test/test_sys_cpu.rb
23
- * test/test_sys_cpu_bsd.rb
24
- * test/test_sys_cpu_hpux.rb
25
- * test/test_sys_cpu_sunos.rb
26
- * test/test_sys_cpu_linux.rb
27
- * test/test_sys_cpu_windows.rb
23
+ * spec/spec_helper.rb
24
+ * spec/sys_cpu_spec.rb
25
+ * spec/sys_cpu_bsd_spec.rb
26
+ * spec/sys_cpu_hpux_spec.rb
27
+ * spec/sys_cpu_linux_spec.rb
28
+ * spec/sys_cpu_sunos_spec.rb
29
+ * spec/sys_cpu_windows_spec.rb
@@ -0,0 +1,75 @@
1
+ = Description
2
+ A Ruby interface for getting cpu information.
3
+
4
+ = Installation
5
+ gem install sys-cpu
6
+
7
+ = Adding the trusted cert
8
+ gem cert --add <(curl -Ls https://raw.githubusercontent.com/djberg96/sys-cpu/ffi/certs/djberg96_pub.pem)
9
+
10
+ = Notes
11
+ == Solaris
12
+ Currently there is no +processors+ iterative method for multi-cpu systems.
13
+ I plan to add it this in a future release.
14
+
15
+ == OS X
16
+ The CPU.model method returns very limited information. I do not yet know
17
+ how to get more detailed information.
18
+
19
+ == Linux
20
+ This is pure Ruby. This version reads information out of /proc/cpuinfo and
21
+ /proc/loadavg, so if /proc isn't mounted it won't work.
22
+
23
+ The key-value information in /proc/cpuinfo is stored internally (i.e. in
24
+ memory) as an array of hashes when you first +require+ this package. This
25
+ overhead is exceptionally minimal, given that your average cpuinfo file
26
+ contains less than 1k of text (and I don't store whitespace or newlines).
27
+
28
+ The text documentation for Linux is dynamically generated during the
29
+ build process because the fields vary depending on your setup. So, don't
30
+ look at it until *after* you've installed it. You will see a doc/linux.txt
31
+ file after you run +rake install+ (via install.rb).
32
+
33
+ == HP-UX
34
+ Unlike other platforms, you can get load averages for an individual cpu in
35
+ multi-cpu systems. See documentation for more details.
36
+
37
+ Note that version 0.7.x and later will not work on HP-UX because of the
38
+ switch to FFI and the lack of a testing platform. However, version 0.6.x
39
+ will work just fine.
40
+
41
+ == MS Windows
42
+ This is a pure Ruby implementation using the win32ole package + WMI. The C
43
+ version has been scrapped.
44
+
45
+ As of version 0.5.0, the CPU.usage method has been removed in favor of the
46
+ CPU.load_avg method. This does not (currently) use a perf counter, so there
47
+ is no longer any delay. Also, the +processors+ method has been added and the
48
+ +supported+ method has been dropped. See the documentation for other changes.
49
+
50
+ = Acknowledgements
51
+ Thanks go to the MPlayer team for some source code that helped me on
52
+ certain versions of FreeBSD in the original C version.
53
+
54
+ = Known Bugs
55
+ None that I'm aware of. Please report bugs on the project page at:
56
+
57
+ https://github.com/djberg96/sys-cpu
58
+
59
+ = Future Plans
60
+ * Add iterative CPU.processors method.
61
+ * Add more information in general, such as what +prtdiag+ shows.
62
+
63
+ = License
64
+ Apache-2.0
65
+
66
+ = Copyright
67
+ (C) 2003-2020 Daniel J. Berger, All Rights Reserved
68
+
69
+ = Warranty
70
+ This package is provided "as is" and without any express or
71
+ implied warranties, including, without limitation, the implied
72
+ warranties of merchantability and fitness for a particular purpose.
73
+
74
+ = Author
75
+ Daniel J. Berger
data/Rakefile CHANGED
@@ -1,10 +1,10 @@
1
1
  require 'rake'
2
2
  require 'rake/clean'
3
- require 'rake/testtask'
4
3
  require 'rbconfig'
4
+ require 'rspec/core/rake_task'
5
5
  include RbConfig
6
6
 
7
- CLEAN.include('**/*.gem', '**/*.rbc', '**/*.rbx')
7
+ CLEAN.include('**/*.gem', '**/*.rbc', '**/*.rbx', '**/*.lock')
8
8
 
9
9
  namespace 'gem' do
10
10
  desc "Create the sys-cpu gem"
@@ -44,9 +44,7 @@ task :example => [:clean] do
44
44
 
45
45
  end
46
46
 
47
- Rake::TestTask.new do |t|
48
- t.libs << 'test'
49
- t.test_files = FileList['test/test_sys_cpu.rb']
50
- end
47
+ desc "Run the test suite"
48
+ RSpec::Core::RakeTask.new(:spec)
51
49
 
52
- task :default => :test
50
+ task :default => :spec
@@ -5,7 +5,7 @@ require 'rbconfig'
5
5
  module Sys
6
6
  class CPU
7
7
  # The version of the sys-cpu gem.
8
- VERSION = '0.8.0'.freeze
8
+ VERSION = '1.0.0'.freeze
9
9
  end
10
10
  end
11
11
 
@@ -70,11 +70,43 @@ module Sys
70
70
  array unless block_given?
71
71
  end
72
72
 
73
+ # Return the total number of logical CPU on the system.
74
+ #
75
+ def self.num_cpu
76
+ CPU_ARRAY.size
77
+ end
78
+
79
+ # Return the architecture of the CPU.
80
+ #
81
+ def self.architecture
82
+ case CPU_ARRAY.first['cpu_family']
83
+ when '3'
84
+ "x86"
85
+ when '6'
86
+ "x86_64"
87
+ else
88
+ nil
89
+ end
90
+ end
91
+
92
+ # Returns a string indicating the CPU model.
93
+ #
94
+ def self.model
95
+ CPU_ARRAY.first['model_name']
96
+ end
97
+
98
+ # Returns an integer indicating the speed of the CPU.
99
+ #
100
+ def self.freq
101
+ CPU_ARRAY.first['cpu_mhz'].to_f.round
102
+ end
103
+
73
104
  private
74
105
 
75
106
  # Create singleton methods for each of the attributes.
76
107
  #
77
108
  def self.method_missing(id, arg=0)
109
+ raise NoMethodError, "'#{id}'" unless CPU_ARRAY[arg].has_key?(id.to_s)
78
110
  rv = CPU_ARRAY[arg][id.to_s]
79
111
  if rv.nil?
80
112
  id = id.to_s + "?"
@@ -278,7 +278,7 @@ module Sys
278
278
  # Note that this value returns nil on my system.
279
279
  #
280
280
  def self.get_cmec(num)
281
- case
281
+ case num
282
282
  when 0
283
283
  str = "The device is working properly."
284
284
  return str
@@ -0,0 +1,9 @@
1
+ require 'rspec'
2
+
3
+ RSpec.configure do |config|
4
+ config.filter_run_excluding(:bsd) if RbConfig::CONFIG['host_os'] !~ /bsd|darwin|mach|osx/i
5
+ config.filter_run_excluding(:sunos) if RbConfig::CONFIG['host_os'] !~ /sunos|solaris/i
6
+ config.filter_run_excluding(:windows) if RbConfig::CONFIG['host_os'] !~ /mswin|win32|dos|mingw|cygwin/i
7
+ config.filter_run_excluding(:hpux) if RbConfig::CONFIG['host_os'] !~ /hpux/i
8
+ config.filter_run_excluding(:linux) if RbConfig::CONFIG['host_os'] !~ /linux/i
9
+ end
@@ -0,0 +1,94 @@
1
+ #############################################################
2
+ # test_sys_cpu_bsd.rb
3
+ #
4
+ # The test case for sys-cpu on BSD flavors, including OS X.
5
+ #############################################################
6
+ require 'sys/cpu'
7
+ require 'spec_helper'
8
+
9
+ RSpec.describe Sys::CPU, :bsd => true do
10
+ example "architecture method basic functionality" do
11
+ expect(Sys::CPU).to respond_to(:architecture)
12
+ expect{ Sys::CPU.architecture }.not_to raise_error
13
+ end
14
+
15
+ example "architecture method returns a sane value" do
16
+ expect(Sys::CPU.architecture).to be_kind_of(String)
17
+ expect(Sys::CPU.architecture.size).to be > 0
18
+ end
19
+
20
+ example "architecture method does not accept any arguments" do
21
+ expect{ Sys::CPU.architecture(0) }.to raise_error(ArgumentError)
22
+ end
23
+
24
+ example "freq method basic functionality" do
25
+ expect(Sys::CPU).to respond_to(:freq)
26
+ expect{ Sys::CPU.freq }.not_to raise_error
27
+ end
28
+
29
+ example "freq method returns expected value" do
30
+ expect(Sys::CPU.freq).to be_kind_of(Integer)
31
+ expect(Sys::CPU.freq).to be > 0
32
+ end
33
+
34
+ example "freq method does not accept any arguments" do
35
+ expect{ Sys::CPU.freq(0) }.to raise_error(ArgumentError)
36
+ end
37
+
38
+ example "load_avg method basic functionality" do
39
+ expect(Sys::CPU).to respond_to(:load_avg)
40
+ expect{ Sys::CPU.load_avg }.not_to raise_error
41
+ end
42
+
43
+ example "load_avg returns the expected results" do
44
+ expect(Sys::CPU.load_avg).to be_kind_of(Array)
45
+ expect(Sys::CPU.load_avg.length).to eq(3)
46
+ expect(Sys::CPU.load_avg[0]).to be_kind_of(Float)
47
+ end
48
+
49
+ example "load_avg does not accept any arguments" do
50
+ expect{ Sys::CPU.load_avg(0) }.to raise_error(ArgumentError)
51
+ end
52
+
53
+ example "machine method basic functionality" do
54
+ expect(Sys::CPU).to respond_to(:machine)
55
+ expect{ Sys::CPU.machine }.not_to raise_error
56
+ end
57
+
58
+ example "machine method returns sane value" do
59
+ expect(Sys::CPU.machine).to be_kind_of(String)
60
+ expect(Sys::CPU.machine.size).to be > 0
61
+ end
62
+
63
+ example "machine method does not accept any arguments" do
64
+ expect{ Sys::CPU.machine(0) }.to raise_error(ArgumentError)
65
+ end
66
+
67
+ example "model method basic functionality" do
68
+ expect(Sys::CPU).to respond_to(:model)
69
+ expect{ Sys::CPU.model }.not_to raise_error
70
+ end
71
+
72
+ example "model method returns sane value" do
73
+ expect(Sys::CPU.model).to be_kind_of(String)
74
+ expect(Sys::CPU.model.length).to be > 0
75
+ end
76
+
77
+ example "model method does not accept any arguments" do
78
+ expect{ Sys::CPU.model(0) }.to raise_error(ArgumentError)
79
+ end
80
+
81
+ example "num_cpu method basic functionality" do
82
+ expect(Sys::CPU).to respond_to(:num_cpu)
83
+ expect{ Sys::CPU.num_cpu }.not_to raise_error
84
+ end
85
+
86
+ example "num_cpu method returns expected value" do
87
+ expect(Sys::CPU.num_cpu).to be_kind_of(Integer)
88
+ expect(Sys::CPU.num_cpu).to be > 0
89
+ end
90
+
91
+ example "num_cpu method does not accept any arguments" do
92
+ expect{ Sys::CPU.num_cpu(0) }.to raise_error(ArgumentError)
93
+ end
94
+ end