File tree Expand file tree Collapse file tree 2 files changed +41
-7
lines changed Expand file tree Collapse file tree 2 files changed +41
-7
lines changed Original file line number Diff line number Diff line change 88 document [ :client ] [ :driver ] [ :version ] . should == Mongo ::VERSION
99 end
1010
11- it 'includes operating system information' do
12- document [ :client ] [ :os ] [ :type ] . should == 'linux'
13- if BSON ::Environment . jruby? || RUBY_VERSION >= '3.0'
14- document [ :client ] [ :os ] [ :name ] . should == 'linux'
15- else
16- document [ :client ] [ :os ] [ :name ] . should == 'linux-gnu'
11+ context 'linux' do
12+ before ( :all ) do
13+ unless SpecConfig . instance . linux?
14+ skip "Linux required, we have #{ RbConfig ::CONFIG [ 'host_os' ] } "
15+ end
16+ end
17+
18+ it 'includes operating system information' do
19+ document [ :client ] [ :os ] [ :type ] . should == 'linux'
20+ if BSON ::Environment . jruby? || RUBY_VERSION >= '3.0'
21+ document [ :client ] [ :os ] [ :name ] . should == 'linux'
22+ else
23+ document [ :client ] [ :os ] [ :name ] . should == 'linux-gnu'
24+ end
25+ document [ :client ] [ :os ] [ :architecture ] . should == 'x86_64'
26+ end
27+ end
28+
29+ context 'macos' do
30+ before ( :all ) do
31+ unless SpecConfig . instance . macos?
32+ skip "MacOS required, we have #{ RbConfig ::CONFIG [ 'host_os' ] } "
33+ end
34+ end
35+
36+ it 'includes operating system information' do
37+ document [ :client ] [ :os ] [ :type ] . should == 'darwin'
38+ if BSON ::Environment . jruby?
39+ document [ :client ] [ :os ] [ :name ] . should == 'darwin'
40+ else
41+ document [ :client ] [ :os ] [ :name ] . should =~ /darwin\d +/
42+ end
43+ document [ :client ] [ :os ] [ :architecture ] . should == 'x86_64'
1744 end
18- document [ :client ] [ :os ] [ :architecture ] . should == 'x86_64'
1945 end
2046
2147 context 'mri' do
Original file line number Diff line number Diff line change @@ -110,6 +110,14 @@ def jruby?
110110 !!( RUBY_PLATFORM =~ /\b java\b / )
111111 end
112112
113+ def linux?
114+ !!( RbConfig ::CONFIG [ 'host_os' ] . downcase =~ /\b linux/ )
115+ end
116+
117+ def macos?
118+ !!( RbConfig ::CONFIG [ 'host_os' ] . downcase =~ /\b darwin/ )
119+ end
120+
113121 def platform
114122 RUBY_PLATFORM
115123 end
You can’t perform that action at this time.
0 commit comments