Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix leaking globals on Windows #1235

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions library/win32ole/fixtures/classes.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
require 'win32ole'

module WIN32OLESpecs
WIN32OLERuntimeError ||= WIN32OLE::RuntimeError
WIN32OLE_TYPELIB ||= WIN32OLE::TypeLib

MSXML_AVAILABLE = WIN32OLE_TYPELIB.typelibs.any? { |t| t.name.start_with?('Microsoft XML') }
SYSTEM_MONITOR_CONTROL_AVAILABLE = WIN32OLE_TYPELIB.typelibs.any? { |t| t.name.start_with?('System Monitor Control') }

Expand Down
4 changes: 0 additions & 4 deletions library/win32ole/win32ole/_getproperty_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
require_relative "../../../spec_helper"
platform_is :windows do
verbose, $VERBOSE = $VERBOSE, nil

require_relative '../fixtures/classes'

describe "WIN32OLE#_getproperty" do
Expand All @@ -14,6 +12,4 @@
@dict._getproperty(0, ['key'], [WIN32OLE::VARIANT::VT_BSTR]).should == 'value'
end
end
ensure
$VERBOSE = verbose
end
4 changes: 0 additions & 4 deletions library/win32ole/win32ole/_invoke_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
require_relative "../../../spec_helper"
platform_is :windows do
verbose, $VERBOSE = $VERBOSE, nil

require_relative '../fixtures/classes'

describe "WIN32OLE#_invoke" do
Expand All @@ -21,6 +19,4 @@

end

ensure
$VERBOSE = verbose
end
4 changes: 0 additions & 4 deletions library/win32ole/win32ole/codepage_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
require_relative "../../../spec_helper"
platform_is :windows do
verbose, $VERBOSE = $VERBOSE, nil

require_relative '../fixtures/classes'

describe "WIN32OLE.codepage=" do
Expand All @@ -13,6 +11,4 @@
end
end

ensure
$VERBOSE = verbose
end
4 changes: 0 additions & 4 deletions library/win32ole/win32ole/connect_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
require_relative "../../../spec_helper"
platform_is :windows do
verbose, $VERBOSE = $VERBOSE, nil

require_relative '../fixtures/classes'

describe "WIN32OLE.connect" do
Expand All @@ -15,6 +13,4 @@
end

end
ensure
$VERBOSE = verbose
end
4 changes: 0 additions & 4 deletions library/win32ole/win32ole/const_load_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
require_relative "../../../spec_helper"
platform_is :windows do
verbose, $VERBOSE = $VERBOSE, nil

require_relative '../fixtures/classes'

describe "WIN32OLE.const_load when passed Shell.Application OLE object" do
Expand Down Expand Up @@ -32,6 +30,4 @@ module WIN32OLE_RUBYSPEC; end
end
end

ensure
$VERBOSE = verbose
end
4 changes: 0 additions & 4 deletions library/win32ole/win32ole/constants_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
require_relative "../../../spec_helper"
platform_is :windows do
verbose, $VERBOSE = $VERBOSE, nil

require_relative '../fixtures/classes'

describe "WIN32OLE class" do
Expand Down Expand Up @@ -42,6 +40,4 @@
end
end

ensure
$VERBOSE = verbose
end
4 changes: 0 additions & 4 deletions library/win32ole/win32ole/create_guid_spec.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
require_relative "../../../spec_helper"
platform_is :windows do
verbose, $VERBOSE = $VERBOSE, nil

require_relative '../fixtures/classes'

describe "WIN32OLE.create_guid" do
it "generates guid with valid format" do
WIN32OLE.create_guid.should =~ /^\{[A-Z0-9]{8}\-[A-Z0-9]{4}\-[A-Z0-9]{4}\-[A-Z0-9]{4}\-[A-Z0-9]{12}/
end
end
ensure
$VERBOSE = verbose
end
4 changes: 0 additions & 4 deletions library/win32ole/win32ole/invoke_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
require_relative "../../../spec_helper"
platform_is :windows do
verbose, $VERBOSE = $VERBOSE, nil

require_relative '../fixtures/classes'

describe "WIN32OLE#invoke" do
Expand All @@ -14,6 +12,4 @@
@dict.invoke('Item', 'key').should == 'value'
end
end
ensure
$VERBOSE = verbose
end
4 changes: 0 additions & 4 deletions library/win32ole/win32ole/locale_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
require_relative "../../../spec_helper"
platform_is :windows do
verbose, $VERBOSE = $VERBOSE, nil

require_relative '../fixtures/classes'

describe "WIN32OLE.locale" do
Expand Down Expand Up @@ -29,6 +27,4 @@
end
end
end
ensure
$VERBOSE = verbose
end
4 changes: 0 additions & 4 deletions library/win32ole/win32ole/new_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
require_relative "../../../spec_helper"
platform_is :windows do
verbose, $VERBOSE = $VERBOSE, nil

require_relative '../fixtures/classes'

describe "WIN32OLESpecs.new_ole" do
Expand All @@ -25,6 +23,4 @@

end

ensure
$VERBOSE = verbose
end
4 changes: 0 additions & 4 deletions library/win32ole/win32ole/ole_func_methods_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
require_relative "../../../spec_helper"
platform_is :windows do
verbose, $VERBOSE = $VERBOSE, nil

require_relative '../fixtures/classes'

describe "WIN32OLE#ole_func_methods" do
Expand All @@ -21,6 +19,4 @@
@dict.ole_func_methods.map { |m| m.name }.include?('AddRef').should be_true
end
end
ensure
$VERBOSE = verbose
end
4 changes: 0 additions & 4 deletions library/win32ole/win32ole/ole_get_methods_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
require_relative "../../../spec_helper"
platform_is :windows do
verbose, $VERBOSE = $VERBOSE, nil

require_relative '../fixtures/classes'

describe "WIN32OLE#ole_get_methods" do
Expand All @@ -16,6 +14,4 @@

end

ensure
$VERBOSE = verbose
end
4 changes: 0 additions & 4 deletions library/win32ole/win32ole/ole_method_help_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
require_relative "../../../spec_helper"
platform_is :windows do
verbose, $VERBOSE = $VERBOSE, nil

require_relative '../fixtures/classes'
require_relative 'shared/ole_method'

Expand All @@ -10,6 +8,4 @@

end

ensure
$VERBOSE = verbose
end
4 changes: 0 additions & 4 deletions library/win32ole/win32ole/ole_method_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
require_relative "../../../spec_helper"
platform_is :windows do
verbose, $VERBOSE = $VERBOSE, nil

require_relative '../fixtures/classes'
require_relative 'shared/ole_method'

Expand All @@ -10,6 +8,4 @@

end

ensure
$VERBOSE = verbose
end
4 changes: 0 additions & 4 deletions library/win32ole/win32ole/ole_methods_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
require_relative "../../../spec_helper"
platform_is :windows do
verbose, $VERBOSE = $VERBOSE, nil

require_relative '../fixtures/classes'

describe "WIN32OLE#ole_methods" do
Expand All @@ -21,6 +19,4 @@
@dict.ole_methods.map { |m| m.name }.include?('AddRef').should be_true
end
end
ensure
$VERBOSE = verbose
end
4 changes: 0 additions & 4 deletions library/win32ole/win32ole/ole_obj_help_spec.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
require_relative "../../../spec_helper"

platform_is :windows do
verbose, $VERBOSE = $VERBOSE, nil

require_relative '../fixtures/classes'

describe "WIN32OLE#ole_obj_help" do
Expand All @@ -18,6 +16,4 @@
@dict.ole_obj_help.kind_of?(WIN32OLE_TYPE).should be_true
end
end
ensure
$VERBOSE = verbose
end
4 changes: 0 additions & 4 deletions library/win32ole/win32ole/ole_put_methods_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
require_relative "../../../spec_helper"
platform_is :windows do
verbose, $VERBOSE = $VERBOSE, nil

require_relative '../fixtures/classes'

describe "WIN32OLE#ole_put_methods" do
Expand All @@ -21,6 +19,4 @@
@dict.ole_put_methods.map { |m| m.name }.include?('Key').should be_true
end
end
ensure
$VERBOSE = verbose
end
4 changes: 0 additions & 4 deletions library/win32ole/win32ole/setproperty_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
require_relative "../../../spec_helper"
platform_is :windows do
verbose, $VERBOSE = $VERBOSE, nil

require_relative '../fixtures/classes'
require_relative 'shared/setproperty'

Expand All @@ -10,6 +8,4 @@

end

ensure
$VERBOSE = verbose
end
4 changes: 0 additions & 4 deletions library/win32ole/win32ole_event/new_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
require_relative "../../../spec_helper"
platform_is :windows do
verbose, $VERBOSE = $VERBOSE, nil

require_relative '../fixtures/classes'

guard -> { WIN32OLESpecs::MSXML_AVAILABLE } do
Expand Down Expand Up @@ -33,6 +31,4 @@
end
end
end
ensure
$VERBOSE = verbose
end
4 changes: 0 additions & 4 deletions library/win32ole/win32ole_event/on_event_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
require_relative "../../../spec_helper"
platform_is :windows do
verbose, $VERBOSE = $VERBOSE, nil

require_relative '../fixtures/classes'
guard -> { WIN32OLESpecs::MSXML_AVAILABLE } do

Expand Down Expand Up @@ -70,6 +68,4 @@ def handler_spec_alt(*args)
end
end
end
ensure
$VERBOSE = verbose
end
4 changes: 0 additions & 4 deletions library/win32ole/win32ole_method/dispid_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
require_relative "../../../spec_helper"
platform_is :windows do
verbose, $VERBOSE = $VERBOSE, nil

require 'win32ole'

describe "WIN32OLE_METHOD#dispid" do
Expand All @@ -20,6 +18,4 @@

end

ensure
$VERBOSE = verbose
end
4 changes: 0 additions & 4 deletions library/win32ole/win32ole_method/event_interface_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
require_relative "../../../spec_helper"
platform_is :windows do
verbose, $VERBOSE = $VERBOSE, nil

require_relative '../fixtures/classes'
guard -> { WIN32OLESpecs::SYSTEM_MONITOR_CONTROL_AVAILABLE } do

Expand All @@ -28,6 +26,4 @@
end
end

ensure
$VERBOSE = verbose
end
4 changes: 0 additions & 4 deletions library/win32ole/win32ole_method/event_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
require_relative "../../../spec_helper"
platform_is :windows do
verbose, $VERBOSE = $VERBOSE, nil

require_relative '../fixtures/classes'
guard -> { WIN32OLESpecs::SYSTEM_MONITOR_CONTROL_AVAILABLE } do

Expand All @@ -22,6 +20,4 @@
end
end

ensure
$VERBOSE = verbose
end
4 changes: 0 additions & 4 deletions library/win32ole/win32ole_method/helpcontext_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
require_relative "../../../spec_helper"
platform_is :windows do
verbose, $VERBOSE = $VERBOSE, nil

require 'win32ole'

describe "WIN32OLE_METHOD#helpcontext" do
Expand All @@ -26,6 +24,4 @@

end

ensure
$VERBOSE = verbose
end
4 changes: 0 additions & 4 deletions library/win32ole/win32ole_method/helpfile_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
require_relative "../../../spec_helper"
platform_is :windows do
verbose, $VERBOSE = $VERBOSE, nil

require 'win32ole'

describe "WIN32OLE_METHOD#helpfile" do
Expand All @@ -20,6 +18,4 @@

end

ensure
$VERBOSE = verbose
end
Loading
Loading