diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml index 92d407b..ec0c467 100644 --- a/.github/workflows/ruby.yml +++ b/.github/workflows/ruby.yml @@ -15,7 +15,7 @@ jobs: test: strategy: matrix: - ruby-version: ['2.6', '2.7', '3.0', '3.1', '3.2', '3.3', 'jruby', 'truffleruby'] + ruby-version: ['2.7', '3.0', '3.1', '3.2', '3.3', 'jruby', 'truffleruby'] platform: [ubuntu-latest, macos-latest, windows-latest] exclude: - ruby-version: truffleruby diff --git a/.rubocop.yml b/.rubocop.yml index 4935ac5..ff9bbc4 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -10,6 +10,8 @@ RSpec/InstanceVariable: Enabled: false RSpec/BeforeAfterAll: Enabled: false +RSpec/SpecFilePathFormat: + Enabled: false AllCops: NewCops: enable @@ -20,6 +22,8 @@ AllCops: - examples/*.rb Lint/AssignmentInCondition: Enabled: false +Style/FetchEnvVar: + Enabled: false Style/HashSyntax: Enabled: false Style/MethodCallWithoutArgsParentheses: @@ -43,7 +47,7 @@ Layout/SpaceBeforeBlockBraces: Metrics/AbcSize: Enabled: false Metrics/BlockLength: - IgnoredMethods: ['describe', 'context'] + AllowedMethods: ['describe', 'context'] Metrics/ClassLength: Enabled: false Metrics/MethodLength: diff --git a/lib/sys/windows/uname.rb b/lib/sys/windows/uname.rb index 25178a3..eb7b708 100644 --- a/lib/sys/windows/uname.rb +++ b/lib/sys/windows/uname.rb @@ -490,7 +490,7 @@ def self.parse_ms_date(str) # String rather than a Fixnum/Bignum. This deals with that for now. # def self.convert(str) - return nil if str.nil? # Don't turn nil into 0 + return nil if str.nil? # Don't turn nil into 0 str.to_i end diff --git a/spec/sys_platform_spec.rb b/spec/sys_platform_spec.rb index 22ec5d4..c071c0a 100644 --- a/spec/sys_platform_spec.rb +++ b/spec/sys_platform_spec.rb @@ -14,15 +14,15 @@ end example 'the ARCH constant is defined' do - expect(Sys::Platform::ARCH).to be_kind_of(Symbol) + expect(Sys::Platform::ARCH).to be_a(Symbol) end example 'the OS constant is defined' do - expect(Sys::Platform::OS).to be_kind_of(Symbol) + expect(Sys::Platform::OS).to be_a(Symbol) end example 'the IMPL constant is defined' do - expect(Sys::Platform::IMPL).to be_kind_of(Symbol) + expect(Sys::Platform::IMPL).to be_a(Symbol) end example 'the IMPL returns an expected value on windows', :windows do diff --git a/spec/sys_uname_spec.rb b/spec/sys_uname_spec.rb index 9b3e969..2e49a11 100644 --- a/spec/sys_uname_spec.rb +++ b/spec/sys_uname_spec.rb @@ -32,41 +32,41 @@ example 'uname basic functionality' do expect{ described_class.uname }.not_to raise_error - expect(described_class.uname).to be_kind_of(Struct) + expect(described_class.uname).to be_a(Struct) end example 'machine singleton method works as expected' do expect(described_class).to respond_to(:machine) expect{ described_class.machine }.not_to raise_error - expect(described_class.machine).to be_kind_of(String) + expect(described_class.machine).to be_a(String) expect(described_class.machine.size).to be > 0 end example 'version singleton method works as expected' do expect(described_class).to respond_to(:version) expect{ described_class.version }.not_to raise_error - expect(described_class.version).to be_kind_of(String) + expect(described_class.version).to be_a(String) expect(described_class.version.size).to be > 0 end example 'nodename singleton method works as expected' do expect(described_class).to respond_to(:nodename) expect{ described_class.nodename }.not_to raise_error - expect(described_class.nodename).to be_kind_of(String) + expect(described_class.nodename).to be_a(String) expect(described_class.nodename.size).to be > 0 end example 'release singleton method works as expected' do expect(described_class).to respond_to(:release) expect{ described_class.release }.not_to raise_error - expect(described_class.release).to be_kind_of(String) + expect(described_class.release).to be_a(String) expect(described_class.release.size).to be > 0 end example 'sysname singleton method works as expected' do expect(described_class).to respond_to(:sysname) expect{ described_class.sysname }.not_to raise_error - expect(described_class.sysname).to be_kind_of(String) + expect(described_class.sysname).to be_a(String) expect(described_class.sysname.size).to be > 0 end end @@ -75,43 +75,43 @@ example 'architecture singleton method works as expected on solaris' do expect(described_class).to respond_to(:architecture) expect{ described_class.architecture }.not_to raise_error - expect(described_class.architecture).to be_kind_of(String) + expect(described_class.architecture).to be_a(String) end example 'platform singleton method works as expected on solaris' do expect(described_class).to respond_to(:platform) expect{ described_class.platform }.not_to raise_error - expect(described_class.platform).to be_kind_of(String) + expect(described_class.platform).to be_a(String) end example 'isa_list singleton method works as expected on solaris' do expect(described_class).to respond_to(:isa_list) expect{ described_class.isa_list }.not_to raise_error - expect(described_class.isa_list).to be_kind_of(String) + expect(described_class.isa_list).to be_a(String) end example 'hw_provider singleton method works as expected on solaris' do expect(described_class).to respond_to(:hw_provider) expect{ described_class.hw_provider }.not_to raise_error - expect(described_class.hw_provider).to be_kind_of(String) + expect(described_class.hw_provider).to be_a(String) end example 'hw_serial singleton method works as expected on solaris' do expect(described_class).to respond_to(:hw_serial) expect{ described_class.hw_serial }.not_to raise_error - expect(described_class.hw_serial).to be_kind_of(Integer) + expect(described_class.hw_serial).to be_a(Integer) end example 'srpc_domain singleton method works as expected on solaris' do expect(described_class).to respond_to(:srpc_domain) expect{ described_class.srpc_domain }.not_to raise_error - expect(described_class.srpc_domain).to be_kind_of(String) + expect(described_class.srpc_domain).to be_a(String) end example 'dhcp_cache singleton method works as expected on solaris' do expect(described_class).to respond_to(:dhcp_cache) expect{ described_class.dhcp_cache }.not_to raise_error - expect(described_class.dhcp_cache).to be_kind_of(String) + expect(described_class.dhcp_cache).to be_a(String) end end @@ -119,7 +119,7 @@ example 'model singleton method works as expected on BSD and Darwin' do expect(described_class).to respond_to(:model) expect{ described_class.model }.not_to raise_error - expect(described_class.model).to be_kind_of(String) + expect(described_class.model).to be_a(String) end end @@ -127,7 +127,7 @@ example 'id_number singleton method works as expected on HP-UX' do expect(described_class).to respond_to(:id_number) expect{ described_class.id_number }.not_to raise_error - expect(described_class.id_number).to be_kind_of(String) + expect(described_class.id_number).to be_a(String) end end @@ -172,57 +172,57 @@ context 'instance methods for MS Windows', :if => File::ALT_SEPARATOR do example 'boot_device' do expect{ described_class.uname.boot_device }.not_to raise_error - expect(described_class.uname.boot_device).to be_kind_of(String) + expect(described_class.uname.boot_device).to be_a(String) end example 'build_number' do expect{ described_class.uname.build_number }.not_to raise_error - expect(described_class.uname.build_number).to be_kind_of(String) + expect(described_class.uname.build_number).to be_a(String) end example 'build_type' do expect{ described_class.uname.build_type }.not_to raise_error - expect(described_class.uname.build_type).to be_kind_of(String) + expect(described_class.uname.build_type).to be_a(String) end example 'caption' do expect{ described_class.uname.caption }.not_to raise_error - expect(described_class.uname.caption).to be_kind_of(String) + expect(described_class.uname.caption).to be_a(String) end example 'code_set' do expect{ described_class.uname.code_set }.not_to raise_error - expect(described_class.uname.code_set).to be_kind_of(String) + expect(described_class.uname.code_set).to be_a(String) end example 'country_code' do expect{ described_class.uname.country_code }.not_to raise_error - expect(described_class.uname.country_code).to be_kind_of(String) + expect(described_class.uname.country_code).to be_a(String) end example 'creation_class_name' do expect{ described_class.uname.creation_class_name }.not_to raise_error - expect(described_class.uname.creation_class_name).to be_kind_of(String) + expect(described_class.uname.creation_class_name).to be_a(String) end example 'cscreation_class_name' do expect{ described_class.uname.cscreation_class_name }.not_to raise_error - expect(described_class.uname.cscreation_class_name).to be_kind_of(String) + expect(described_class.uname.cscreation_class_name).to be_a(String) end example 'csd_version' do expect{ described_class.uname.csd_version }.not_to raise_error - expect(described_class.uname.csd_version).to be_kind_of(String).or be_nil + expect(described_class.uname.csd_version).to be_a(String).or be_nil end example 'cs_name' do expect{ described_class.uname.cs_name }.not_to raise_error - expect(described_class.uname.cs_name).to be_kind_of(String) + expect(described_class.uname.cs_name).to be_a(String) end example 'current_time_zone' do expect{ described_class.uname.current_time_zone }.not_to raise_error - expect(described_class.uname.current_time_zone).to be_kind_of(Integer) + expect(described_class.uname.current_time_zone).to be_a(Integer) end example 'debug' do @@ -232,7 +232,7 @@ example 'description' do expect{ described_class.uname.description }.not_to raise_error - expect(described_class.uname.description).to be_kind_of(String) + expect(described_class.uname.description).to be_a(String) end example 'distributed' do @@ -242,117 +242,117 @@ example 'encryption_level' do expect{ described_class.uname.encryption_level }.not_to raise_error - expect(described_class.uname.encryption_level).to be_kind_of(Integer) + expect(described_class.uname.encryption_level).to be_a(Integer) end example 'foreground_application_boost' do expect{ described_class.uname.foreground_application_boost }.not_to raise_error - expect(described_class.uname.foreground_application_boost).to be_kind_of(Integer) + expect(described_class.uname.foreground_application_boost).to be_a(Integer) end example 'free_physical_memory' do expect{ described_class.uname.free_physical_memory }.not_to raise_error - expect(described_class.uname.free_physical_memory).to be_kind_of(Integer) + expect(described_class.uname.free_physical_memory).to be_a(Integer) end example 'free_space_in_paging_files' do expect{ described_class.uname.free_space_in_paging_files }.not_to raise_error - expect(described_class.uname.free_space_in_paging_files).to be_kind_of(Integer) + expect(described_class.uname.free_space_in_paging_files).to be_a(Integer) end example 'free_virtual_memory' do expect{ described_class.uname.free_virtual_memory }.not_to raise_error - expect(described_class.uname.free_virtual_memory).to be_kind_of(Integer) + expect(described_class.uname.free_virtual_memory).to be_a(Integer) end example 'install_date' do expect{ described_class.uname.install_date }.not_to raise_error - expect(described_class.uname.install_date).to be_kind_of(Time) + expect(described_class.uname.install_date).to be_a(Time) end example 'last_bootup_time' do expect{ described_class.uname.last_bootup_time }.not_to raise_error - expect(described_class.uname.last_bootup_time).to be_kind_of(Time) + expect(described_class.uname.last_bootup_time).to be_a(Time) end example 'local_date_time' do expect{ described_class.uname.local_date_time }.not_to raise_error - expect(described_class.uname.local_date_time).to be_kind_of(Time) + expect(described_class.uname.local_date_time).to be_a(Time) end example 'locale' do expect{ described_class.uname.locale }.not_to raise_error - expect(described_class.uname.locale).to be_kind_of(String) + expect(described_class.uname.locale).to be_a(String) end example 'manufacturer' do expect{ described_class.uname.manufacturer }.not_to raise_error - expect(described_class.uname.manufacturer).to be_kind_of(String) + expect(described_class.uname.manufacturer).to be_a(String) end example 'max_number_of_processes' do expect{ described_class.uname.max_number_of_processes }.not_to raise_error - expect(described_class.uname.max_number_of_processes).to be_kind_of(Integer) + expect(described_class.uname.max_number_of_processes).to be_a(Integer) end example 'max_process_memory_size' do expect{ described_class.uname.max_process_memory_size }.not_to raise_error - expect(described_class.uname.max_process_memory_size).to be_kind_of(Integer) + expect(described_class.uname.max_process_memory_size).to be_a(Integer) end example 'name' do expect{ described_class.uname.name }.not_to raise_error - expect(described_class.uname.name).to be_kind_of(String) + expect(described_class.uname.name).to be_a(String) end example 'number_of_licensed_users' do expect{ described_class.uname.number_of_licensed_users }.not_to raise_error - expect(described_class.uname.number_of_licensed_users).to be_kind_of(Integer).or be_nil + expect(described_class.uname.number_of_licensed_users).to be_a(Integer).or be_nil end example 'number_of_processes' do expect{ described_class.uname.number_of_processes }.not_to raise_error - expect(described_class.uname.number_of_processes).to be_kind_of(Integer) + expect(described_class.uname.number_of_processes).to be_a(Integer) end example 'number_of_users' do expect{ described_class.uname.number_of_users }.not_to raise_error - expect(described_class.uname.number_of_users).to be_kind_of(Integer) + expect(described_class.uname.number_of_users).to be_a(Integer) end example 'organization', :unless => ENV['CI'] do expect{ described_class.uname.organization }.not_to raise_error - expect(described_class.uname.organization).to be_kind_of(String) + expect(described_class.uname.organization).to be_a(String) end example 'os_language' do expect{ described_class.uname.os_language }.not_to raise_error - expect(described_class.uname.os_language).to be_kind_of(Integer) + expect(described_class.uname.os_language).to be_a(Integer) end example 'os_product_suite' do expect{ described_class.uname.os_product_suite }.not_to raise_error - expect(described_class.uname.os_product_suite).to be_kind_of(Integer) + expect(described_class.uname.os_product_suite).to be_a(Integer) end example 'os_type' do expect{ described_class.uname.os_type }.not_to raise_error - expect(described_class.uname.os_type).to be_kind_of(Integer) + expect(described_class.uname.os_type).to be_a(Integer) end example 'other_type_description' do expect{ described_class.uname.other_type_description }.not_to raise_error - expect(described_class.uname.other_type_description).to be_kind_of(String).or be_nil + expect(described_class.uname.other_type_description).to be_a(String).or be_nil end example 'plus_product_id' do expect{ described_class.uname.plus_product_id }.not_to raise_error - expect(described_class.uname.plus_product_id).to be_kind_of(Integer).or be_nil + expect(described_class.uname.plus_product_id).to be_a(Integer).or be_nil end example 'plus_version_number' do expect{ described_class.uname.plus_version_number }.not_to raise_error - expect(described_class.uname.plus_version_number).to be_kind_of(Integer).or be_nil + expect(described_class.uname.plus_version_number).to be_a(Integer).or be_nil end example 'primary' do @@ -362,88 +362,88 @@ example 'product_type' do expect{ described_class.uname.product_type }.not_to raise_error - expect(described_class.uname.product_type).to be_kind_of(Integer) + expect(described_class.uname.product_type).to be_a(Integer) end example 'quantum_length' do expect{ described_class.uname.quantum_length }.not_to raise_error - expect(described_class.uname.quantum_length).to be_kind_of(Integer).or be_nil + expect(described_class.uname.quantum_length).to be_a(Integer).or be_nil end example 'quantum_type' do expect{ described_class.uname.quantum_type }.not_to raise_error - expect(described_class.uname.quantum_type).to be_kind_of(Integer).or be_nil + expect(described_class.uname.quantum_type).to be_a(Integer).or be_nil end example 'registered_user', :unless => ENV['CI'] do expect{ described_class.uname.registered_user }.not_to raise_error - expect(described_class.uname.registered_user).to be_kind_of(String) + expect(described_class.uname.registered_user).to be_a(String) end example 'serial_number' do expect{ described_class.uname.serial_number }.not_to raise_error - expect(described_class.uname.serial_number).to be_kind_of(String) + expect(described_class.uname.serial_number).to be_a(String) end example 'service_pack_major_version' do expect{ described_class.uname.service_pack_major_version }.not_to raise_error - expect(described_class.uname.service_pack_major_version).to be_kind_of(Integer) + expect(described_class.uname.service_pack_major_version).to be_a(Integer) end example 'service_pack_minor_version' do expect{ described_class.uname.service_pack_minor_version }.not_to raise_error - expect(described_class.uname.service_pack_minor_version).to be_kind_of(Integer) + expect(described_class.uname.service_pack_minor_version).to be_a(Integer) end example 'status' do expect{ described_class.uname.status }.not_to raise_error - expect(described_class.uname.status).to be_kind_of(String) + expect(described_class.uname.status).to be_a(String) end example 'suite_mask' do expect{ described_class.uname.suite_mask }.not_to raise_error - expect(described_class.uname.suite_mask).to be_kind_of(Integer) + expect(described_class.uname.suite_mask).to be_a(Integer) end example 'system_device' do expect{ described_class.uname.system_device }.not_to raise_error - expect(described_class.uname.system_device).to be_kind_of(String) + expect(described_class.uname.system_device).to be_a(String) end example 'system_directory' do expect{ described_class.uname.system_directory }.not_to raise_error - expect(described_class.uname.system_directory).to be_kind_of(String) + expect(described_class.uname.system_directory).to be_a(String) end example 'system_drive' do expect{ described_class.uname.system_drive }.not_to raise_error - expect(described_class.uname.system_drive).to be_kind_of(String) + expect(described_class.uname.system_drive).to be_a(String) expect(described_class.uname.system_drive).to eql('C:') end example 'total_swap_space_size' do expect{ described_class.uname.total_swap_space_size }.not_to raise_error - expect(described_class.uname.total_swap_space_size).to be_kind_of(Integer).or be_nil + expect(described_class.uname.total_swap_space_size).to be_a(Integer).or be_nil end example 'total_virtual_memory_size' do expect{ described_class.uname.total_virtual_memory_size }.not_to raise_error - expect(described_class.uname.total_virtual_memory_size).to be_kind_of(Integer) + expect(described_class.uname.total_virtual_memory_size).to be_a(Integer) end example 'total_visible_memory_size' do expect{ described_class.uname.total_visible_memory_size }.not_to raise_error - expect(described_class.uname.total_visible_memory_size).to be_kind_of(Integer) + expect(described_class.uname.total_visible_memory_size).to be_a(Integer) end example 'version' do expect{ described_class.uname.version }.not_to raise_error - expect(described_class.uname.version).to be_kind_of(String) + expect(described_class.uname.version).to be_a(String) end example 'windows_directory' do expect{ described_class.uname.windows_directory }.not_to raise_error - expect(described_class.uname.windows_directory).to be_kind_of(String) + expect(described_class.uname.windows_directory).to be_a(String) end end end