From 1a16a77de44c6df9ffe3c5622e6811d4e2f8882f Mon Sep 17 00:00:00 2001 From: Tim Smith Date: Mon, 22 Aug 2016 14:57:25 -0700 Subject: [PATCH] Add the darwin platform family Darwin is BSD, but it shouldn't be lumped in with BSD platforms. There's way too much different. Signed-off-by: Tim Smith --- lib/train/extras/os_common.rb | 3 +++ test/unit/extras/os_common_test.rb | 10 ++++++++++ 2 files changed, 13 insertions(+) diff --git a/lib/train/extras/os_common.rb b/lib/train/extras/os_common.rb index e2058e76..b126f523 100644 --- a/lib/train/extras/os_common.rb +++ b/lib/train/extras/os_common.rb @@ -60,6 +60,9 @@ def to_hash 'esx' => %w{ esx }, + 'darwin' => %w{ + darwin + }, } OS['linux'] = %w{linux alpine arch coreos exherbo gentoo slackware fedora amazon} + OS['redhat'] + OS['debian'] + OS['suse'] diff --git a/test/unit/extras/os_common_test.rb b/test/unit/extras/os_common_test.rb index 6a7f8f4d..a0e8ac7a 100644 --- a/test/unit/extras/os_common_test.rb +++ b/test/unit/extras/os_common_test.rb @@ -286,4 +286,14 @@ def mock_platform(x) it { os.esx?.must_equal(true) } end + describe 'with platform set to darwin' do + let(:os) { mock_platform('darwin') } + it { os.solaris?.must_equal(false) } + it { os.linux?.must_equal(false) } + it {os[:family].must_equal('darwin')} + it { os.unix?.must_equal(true) } + it { os.bsd?.must_equal(true) } + it { os.esx?.must_equal(false) } + end + end