diff options
author | Tim Smith <tsmith84@gmail.com> | 2020-08-12 09:10:30 -0700 |
---|---|---|
committer | Tim Smith <tsmith84@gmail.com> | 2020-09-02 14:08:29 -0700 |
commit | cf8de6c5b07a74e94e8194b484f28c3e2c73d483 (patch) | |
tree | 7331820c7536ffb0f9ded304a0cb1fd75beab144 | |
parent | 9af89458b127a661a14605ca9f16bab17a748f9e (diff) | |
download | chef-cf8de6c5b07a74e94e8194b484f28c3e2c73d483.tar.gz |
Minor tweaks to the platform checks in the specs
Use match? to make sure we always get a bool back. Rename os_x? to
macos?
Signed-off-by: Tim Smith <tsmith@chef.io>
-rw-r--r-- | spec/functional/resource/link_spec.rb | 4 | ||||
-rw-r--r-- | spec/support/platform_helpers.rb | 12 |
2 files changed, 8 insertions, 8 deletions
diff --git a/spec/functional/resource/link_spec.rb b/spec/functional/resource/link_spec.rb index 3ea4d7d824..fea3aa6088 100644 --- a/spec/functional/resource/link_spec.rb +++ b/spec/functional/resource/link_spec.rb @@ -406,7 +406,7 @@ describe Chef::Resource::Link do it "create errors out" do if windows? expect { resource.run_action(:create) }.to raise_error(Errno::EACCES) - elsif os_x? || solaris? || freebsd? || aix? + elsif macos? || solaris? || freebsd? || aix? expect { resource.run_action(:create) }.to raise_error(Errno::EPERM) else expect { resource.run_action(:create) }.to raise_error(Errno::EISDIR) @@ -609,7 +609,7 @@ describe Chef::Resource::Link do it "errors out" do if windows? expect { resource.run_action(:create) }.to raise_error(Errno::EACCES) - elsif os_x? || solaris? || freebsd? || aix? + elsif macos? || solaris? || freebsd? || aix? expect { resource.run_action(:create) }.to raise_error(Errno::EPERM) else expect { resource.run_action(:create) }.to raise_error(Errno::EISDIR) diff --git a/spec/support/platform_helpers.rb b/spec/support/platform_helpers.rb index 7f95544f4c..2cefbaf567 100644 --- a/spec/support/platform_helpers.rb +++ b/spec/support/platform_helpers.rb @@ -152,19 +152,19 @@ def unix? end def linux? - !!(RUBY_PLATFORM =~ /linux/) + RUBY_PLATFORM.match?(/linux/) end -def os_x? - !!(RUBY_PLATFORM =~ /darwin/) +def macos? + RUBY_PLATFORM.match?(/darwin/) end def solaris? - !!(RUBY_PLATFORM =~ /solaris/) + RUBY_PLATFORM.match?(/solaris/) end def freebsd? - !!(RUBY_PLATFORM =~ /freebsd/) + RUBY_PLATFORM.match?(/freebsd/) end def intel_64bit? @@ -200,7 +200,7 @@ def debian_family? end def aix? - !!(RUBY_PLATFORM =~ /aix/) + RUBY_PLATFORM.match?(/aix/) end def wpar? |