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