summaryrefslogtreecommitdiff
path: root/spec/support/chef_helpers.rb
diff options
context:
space:
mode:
authorsersut <serdar@opscode.com>2013-03-29 12:41:11 -0700
committersersut <serdar@opscode.com>2013-03-29 12:41:11 -0700
commite8e7bebb19a6dffa951d1edc57d5bb88780cc52c (patch)
tree3bca3cdc9b357002e0f36cccf110d15fe38cd7a6 /spec/support/chef_helpers.rb
parent718f6073328088b3d5363fb7312bda282efd8c42 (diff)
downloadchef-e8e7bebb19a6dffa951d1edc57d5bb88780cc52c.tar.gz
Fix the service_manager_tests on commit verification pipeline
Diffstat (limited to 'spec/support/chef_helpers.rb')
-rw-r--r--spec/support/chef_helpers.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/spec/support/chef_helpers.rb b/spec/support/chef_helpers.rb
index 2d7fe609b8..d9204d5023 100644
--- a/spec/support/chef_helpers.rb
+++ b/spec/support/chef_helpers.rb
@@ -61,3 +61,18 @@ def has_diff?
false
end
end
+
+# This is a helper to determine if the ruby in the PATH contains
+# win32/service gem. windows_service_manager tests create a windows
+# service that starts with the system ruby and requires this gem.
+def system_windows_service_gem?
+ if defined?(Bundler)
+ Bundler.with_clean_env do
+ # This returns true if the gem can be loaded
+ system "ruby -e 'require \"win32/daemon\"'"
+ end
+ else
+ # This returns true if the gem can be loaded
+ system "ruby -e 'require \"win32/daemon\"'"
+ end
+end