Unverified Commit cf78a496 authored by Tim Smith's avatar Tim Smith Committed by GitHub
Browse files

Merge pull request #13 from chef/lcg/begin-deprecation

Additional Chef-15 greenification
parents 3874bf4a f72d578f
......@@ -51,7 +51,11 @@ class Chef
# @return [String]
#
def dev_null(node)
Chef::Sugar::PlatformFamily.windows?(node) ? 'NUL' : '/dev/null'
if defined?(ChefUtils)
ChefUtils.windows?(node) ? 'NUL' : '/dev/null'
else
Chef::Sugar::PlatformFamily.windows?(node) ? 'NUL' : '/dev/null'
end
end
#
......
......@@ -3,174 +3,6 @@ require 'spec_helper'
describe Chef::Sugar::Platform do
it_behaves_like 'a chef sugar'
describe '#linux_mint?' do
it 'returns true when the platform is linux mint' do
node = { 'platform' => 'linuxmint' }
expect(described_class.linux_mint?(node)).to be true
end
it 'returns false when the platform is not linux mint' do
node = { 'platform' => 'windows' }
expect(described_class.linux_mint?(node)).to be false
end
end
describe '#ubuntu?' do
it 'returns true when the platform is ubuntu' do
node = { 'platform' => 'ubuntu' }
expect(described_class.ubuntu?(node)).to be true
end
it 'returns false when the platform is not ubuntu' do
node = { 'platform' => 'windows' }
expect(described_class.ubuntu?(node)).to be false
end
end
describe '#amazon_linux?' do
it 'returns true when the platform is amazon linux' do
node = { 'platform' => 'amazon' }
expect(described_class.amazon_linux?(node)).to be true
end
it 'returns false when the platform is not amazon linux' do
node = { 'platform' => 'windows' }
expect(described_class.amazon_linux?(node)).to be false
end
end
describe '#centos?' do
it 'returns true when the platform is centos' do
node = { 'platform' => 'centos' }
expect(described_class.centos?(node)).to be true
end
it 'returns false when the platform is not centos' do
node = { 'platform' => 'windows' }
expect(described_class.centos?(node)).to be false
end
end
describe '#oracle_linux?' do
it 'returns true when the platform is oracle linux' do
node = { 'platform' => 'oracle' }
expect(described_class.oracle_linux?(node)).to be true
end
it 'returns false when the platform is not oracle linux' do
node = { 'platform' => 'windows' }
expect(described_class.oracle_linux?(node)).to be false
end
end
describe '#scientific_linux?' do
it 'returns true when the platform is scientific linux' do
node = { 'platform' => 'scientific' }
expect(described_class.scientific_linux?(node)).to be true
end
it 'returns false when the platform is not scientific linux' do
node = { 'platform' => 'windows' }
expect(described_class.scientific_linux?(node)).to be false
end
end
describe '#redhat_enterprise_linux?' do
it 'returns true when the platform is redhat enterprise linux' do
node = { 'platform' => 'redhat' }
expect(described_class.redhat_enterprise_linux?(node)).to be true
end
it 'returns false when the platform is not redhat enterprise linux' do
node = { 'platform' => 'enterprise' }
expect(described_class.redhat_enterprise_linux?(node)).to be false
end
end
describe '#solaris2?' do
it 'returns true when the platform is solaris2' do
node = { 'platform' => 'solaris2' }
expect(described_class.solaris2?(node)).to be true
end
it 'returns false when the platform is not solaris2' do
node = { 'platform' => 'windows' }
expect(described_class.solaris2?(node)).to be false
end
end
describe '#aix?' do
it 'returns true when the platform is aix' do
node = { 'platform' => 'aix' }
expect(described_class.aix?(node)).to be true
end
it 'returns false when the platform is not aix' do
node = { 'platform' => 'windows' }
expect(described_class.aix?(node)).to be false
end
end
describe '#smartos?' do
it 'returns true when the platform is smartos' do
node = { 'platform' => 'smartos' }
expect(described_class.smartos?(node)).to be true
end
it 'returns false when the platform is not smartos' do
node = { 'platform' => 'windows' }
expect(described_class.smartos?(node)).to be false
end
end
describe '#omnios?' do
it 'returns true when the platform is omnios' do
node = { 'platform' => 'omnios' }
expect(described_class.omnios?(node)).to be true
end
it 'returns false when the platform is not omnios' do
node = { 'platform' => 'windows' }
expect(described_class.omnios?(node)).to be false
end
end
describe '#raspbian?' do
it 'returns true when platform is raspbian' do
node = { 'platform' => 'raspbian' }
expect(described_class.raspbian?(node)).to be true
end
it 'returns false when the platform is not raspbian' do
node = { 'platform' => 'windows' }
expect(described_class.raspbian?(node)).to be false
end
end
describe '#nexus' do
it 'returns true when the platform is nexus' do
node = { 'platform' => 'nexus' }
expect(described_class.nexus?(node)).to be true
end
it 'returns false when the platform is not nexus' do
node = { 'platform' => 'windows' }
expect(described_class.nexus?(node)).to be false
end
end
describe '#ios_xr' do
it 'returns true when the platform is ios_xr' do
node = { 'platform' => 'ios_xr' }
expect(described_class.ios_xr?(node)).to be true
end
it 'returns false when the platform is not ios_xr' do
node = { 'platform' => 'windows' }
expect(described_class.ios_xr?(node)).to be false
end
end
describe '#platform_version' do
it 'returns the platform version' do
node = { 'platform_version' => '1.2.3' }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment