[rubygems/rubygems] Fix error handling of #with_engine_version
* If settings constants fail, show that exception instead of getting another one due to variables being unset and hiding the real cause. https://github.com/rubygems/rubygems/commit/f38cd67874
This commit is contained in:
parent
f9dac1bd54
commit
2ea2108a9f
@ -34,21 +34,22 @@ class TestGemRequestSetGemDependencyAPI < Gem::TestCase
|
|||||||
|
|
||||||
Gem.instance_variable_set :@ruby_version, Gem::Version.new(version)
|
Gem.instance_variable_set :@ruby_version, Gem::Version.new(version)
|
||||||
|
|
||||||
yield
|
begin
|
||||||
|
yield
|
||||||
|
ensure
|
||||||
|
Object.send :remove_const, :RUBY_ENGINE if name
|
||||||
|
Object.send :remove_const, new_engine_version_const if version
|
||||||
|
|
||||||
ensure
|
Object.send :remove_const, engine_version_const if name == 'ruby' and
|
||||||
Object.send :remove_const, :RUBY_ENGINE if name
|
Object.const_defined? engine_version_const
|
||||||
Object.send :remove_const, new_engine_version_const if version
|
|
||||||
|
|
||||||
Object.send :remove_const, engine_version_const if name == 'ruby' and
|
Object.const_set :RUBY_ENGINE, engine if engine
|
||||||
Object.const_defined? engine_version_const
|
Object.const_set engine_version_const, engine_version unless
|
||||||
|
Object.const_defined? engine_version_const
|
||||||
|
|
||||||
Object.const_set :RUBY_ENGINE, engine if engine
|
Gem.send :remove_instance_variable, :@ruby_version if
|
||||||
Object.const_set engine_version_const, engine_version unless
|
Gem.instance_variables.include? :@ruby_version
|
||||||
Object.const_defined? engine_version_const
|
end
|
||||||
|
|
||||||
Gem.send :remove_instance_variable, :@ruby_version if
|
|
||||||
Gem.instance_variables.include? :@ruby_version
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_gempspec_with_multiple_runtime_deps
|
def test_gempspec_with_multiple_runtime_deps
|
||||||
|
Loading…
x
Reference in New Issue
Block a user