summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Edwards <adamed@opscode.com>2014-01-08 22:48:49 -0800
committeradamedx <adamed@opscode.com>2014-01-13 12:32:40 -0800
commit5b885dc4f4284f7c9444c2c47902e802ddbff2f1 (patch)
tree867a21f2ee4f901057f68135a607a6137ea09abc
parentc489fd45630cf555526c9cf66ae6540a2685d127 (diff)
downloadchef-5b885dc4f4284f7c9444c2c47902e802ddbff2f1.tar.gz
Add support for Windows domain join spec filter
-rw-r--r--spec/spec_helper.rb1
-rw-r--r--spec/support/platform_helpers.rb8
2 files changed, 8 insertions, 1 deletions
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index e60bdfd434..fcb6dba992 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -108,6 +108,7 @@ RSpec.configure do |config|
config.filter_run_excluding :win2k3_only => true unless windows_win2k3?
config.filter_run_excluding :windows64_only => true unless windows64?
config.filter_run_excluding :windows32_only => true unless windows32?
+ config.filter_run_excluding :windows_domain_joined_only => true unless windows_domain_joined?
config.filter_run_excluding :solaris_only => true unless solaris?
config.filter_run_excluding :system_windows_service_gem_only => true unless system_windows_service_gem?
config.filter_run_excluding :unix_only => true unless unix?
diff --git a/spec/support/platform_helpers.rb b/spec/support/platform_helpers.rb
index 66f1fd4b25..884893865f 100644
--- a/spec/support/platform_helpers.rb
+++ b/spec/support/platform_helpers.rb
@@ -27,9 +27,15 @@ def windows?
!!(RUBY_PLATFORM =~ /mswin|mingw|windows/)
end
+require 'ruby-wmi' if windows?
+
+def windows_domain_joined?
+ return false unless windows?
+ WMI::Win32_ComputerSystem.find(:first).PartOfDomain
+end
+
def windows_win2k3?
return false unless windows?
- require 'ruby-wmi'
host = WMI::Win32_OperatingSystem.find(:first)
(host.version && host.version.start_with?("5.2"))