sys-uname 1.2.2 → 1.2.3

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.
data/lib/sys-uname.rb CHANGED
@@ -1 +1,3 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'sys/uname'
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'rspec'
4
+ require 'sys/uname'
5
+
6
+ RSpec.configure do |config|
7
+ config.filter_run_excluding(:solaris) unless RbConfig::CONFIG['host_os'] =~ /sunos|solaris/i
8
+ config.filter_run_excluding(:bsd) unless RbConfig::CONFIG['host_os'] =~ /powerpc|darwin|macos|bsd/i
9
+ config.filter_run_excluding(:hpux) unless RbConfig::CONFIG['host_os'] =~ /hpux/i
10
+ config.filter_run_excluding(:linux) unless RbConfig::CONFIG['host_os'] =~ /linux/i
11
+ config.filter_run_excluding(:windows) unless Gem.win_platform?
12
+ end
@@ -1,75 +1,69 @@
1
+ # frozen_string_literal: true
2
+
1
3
  ##############################################################################
2
4
  # sys_platform_spec.rb
3
5
  #
4
6
  # Test suite for the Sys::Platform class.
5
7
  ##############################################################################
6
- require 'rspec'
7
- require 'sys/uname'
8
- require 'rbconfig'
8
+ require 'spec_helper'
9
9
 
10
10
  RSpec.describe Sys::Platform do
11
-
12
- before(:context) do
13
- @host_os = RbConfig::CONFIG['host_os']
14
- @windows = @host_os =~ /mingw|mswin|windows/i ? true : false
15
- end
16
-
17
- example "the VERSION constant is set to the expected value" do
18
- expect(Sys::Platform::VERSION).to eql('1.2.2')
11
+ example 'the VERSION constant is set to the expected value' do
12
+ expect(Sys::Platform::VERSION).to eql('1.2.3')
19
13
  expect(Sys::Platform::VERSION).to be_frozen
20
14
  end
21
15
 
22
- example "the ARCH constant is defined" do
16
+ example 'the ARCH constant is defined' do
23
17
  expect(Sys::Platform::ARCH).to be_kind_of(Symbol)
24
18
  end
25
19
 
26
- example "the OS constant is defined" do
20
+ example 'the OS constant is defined' do
27
21
  expect(Sys::Platform::OS).to be_kind_of(Symbol)
28
22
  end
29
23
 
30
- example "the IMPL constant is defined" do
24
+ example 'the IMPL constant is defined' do
31
25
  expect(Sys::Platform::IMPL).to be_kind_of(Symbol)
32
26
  end
33
27
 
34
- example "the IMPL returns an expected value", :if => @windows do
35
- expect(Sys::Platform::IMPL).to include([:mingw, :mswin])
28
+ example 'the IMPL returns an expected value on windows', :windows do
29
+ expect(%i[mingw mswin]).to include(Sys::Platform::IMPL)
36
30
  end
37
31
 
38
- example "the mac? method is defined and returns a boolean" do
39
- expect(Sys::Platform).to respond_to(:mac?)
40
- expect(Sys::Platform.mac?).to eql(true).or eql(false)
32
+ example 'the mac? method is defined and returns a boolean' do
33
+ expect(described_class).to respond_to(:mac?)
34
+ expect(described_class.mac?).to eql(true).or eql(false)
41
35
  end
42
36
 
43
- example "the windows? method is defined and returns a boolean" do
44
- expect(Sys::Platform).to respond_to(:windows?)
45
- expect(Sys::Platform.windows?).to eql(true).or eql(false)
37
+ example 'the windows? method is defined and returns a boolean' do
38
+ expect(described_class).to respond_to(:windows?)
39
+ expect(described_class.windows?).to eql(true).or eql(false)
46
40
  end
47
41
 
48
- example "the windows? method returns the expected value" do
49
- expect(Sys::Platform.windows?).to eql(@windows)
42
+ example 'the windows? method returns the expected value' do
43
+ expect(described_class.windows?).to eql(Gem.win_platform?)
50
44
  end
51
45
 
52
- example "the unix? method is defined and returns a boolean" do
53
- expect(Sys::Platform).to respond_to(:unix?)
54
- expect(Sys::Platform.unix?).to eql(true).or eql(false)
46
+ example 'the unix? method is defined and returns a boolean' do
47
+ expect(described_class).to respond_to(:unix?)
48
+ expect(described_class.unix?).to eql(true).or eql(false)
55
49
  end
56
50
 
57
- example "the unix? method returns the expected value" do
58
- expect(Sys::Platform.unix?).not_to eql(@windows)
51
+ example 'the unix? method returns the expected value' do
52
+ expect(described_class.unix?).not_to eql(Gem.win_platform?)
59
53
  end
60
54
 
61
- example "the solaris? method is defined and returns a boolean" do
62
- expect(Sys::Platform).to respond_to(:solaris?)
63
- expect(Sys::Platform.solaris?).to eql(true).or eql(false)
55
+ example 'the solaris? method is defined and returns a boolean' do
56
+ expect(described_class).to respond_to(:solaris?)
57
+ expect(described_class.solaris?).to eql(true).or eql(false)
64
58
  end
65
59
 
66
- example "the linux? method is defined and returns a boolean" do
67
- expect(Sys::Platform).to respond_to(:linux?)
68
- expect(Sys::Platform.linux?).to eql(true).or eql(false)
60
+ example 'the linux? method is defined and returns a boolean' do
61
+ expect(described_class).to respond_to(:linux?)
62
+ expect(described_class.linux?).to eql(true).or eql(false)
69
63
  end
70
64
 
71
- example "the bsd? method is defined and returns a boolean" do
72
- expect(Sys::Platform).to respond_to(:bsd?)
73
- expect(Sys::Platform.bsd?).to eql(true).or eql(false)
65
+ example 'the bsd? method is defined and returns a boolean' do
66
+ expect(described_class).to respond_to(:bsd?)
67
+ expect(described_class.bsd?).to eql(true).or eql(false)
74
68
  end
75
69
  end