Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Pull enable_shared helper up to TestCase

This functionality can be reused.
  • Loading branch information...
commit 4f6281ed112960b6d2fbf7a2985b410a6d8a6c67 1 parent d2fd2d5
@drbrain drbrain authored
Showing with 17 additions and 13 deletions.
  1. +17 −0 lib/rubygems/test_case.rb
  2. +0 −13 test/rubygems/test_gem.rb
View
17 lib/rubygems/test_case.rb
@@ -115,6 +115,23 @@ def assert_path_exists path, msg = nil
assert File.exist?(path), msg
end
+ ##
+ # Sets the ENABLE_SHARED entry in RbConfig::CONFIG to +value+ and restores
+ # the original value when the block ends
+
+ def enable_shared value
+ enable_shared = RbConfig::CONFIG['ENABLE_SHARED']
+ RbConfig::CONFIG['ENABLE_SHARED'] = value
+
+ yield
+ ensure
+ if enable_shared then
+ RbConfig::CONFIG['enable_shared'] = enable_shared
+ else
+ RbConfig::CONFIG.delete 'enable_shared'
+ end
+ end
+
# TODO: move to minitest
def refute_path_exists path, msg = nil
msg = message(msg) { "Expected path '#{path}' to not exist" }
View
13 test/rubygems/test_gem.rb
@@ -1341,19 +1341,6 @@ def test_use_gemdeps_specific
ENV['RUBYGEMS_GEMDEPS'] = rubygems_gemdeps
end
- def enable_shared value
- enable_shared = RbConfig::CONFIG['ENABLE_SHARED']
- RbConfig::CONFIG['ENABLE_SHARED'] = value
-
- yield
- ensure
- if enable_shared then
- RbConfig::CONFIG['enable_shared'] = enable_shared
- else
- RbConfig::CONFIG.delete 'enable_shared'
- end
- end
-
def ruby_install_name name
orig_RUBY_INSTALL_NAME = RbConfig::CONFIG['ruby_install_name']
RbConfig::CONFIG['ruby_install_name'] = name
Please sign in to comment.
Something went wrong with that request. Please try again.