Skip to content

Commit a65b6fb

Browse files
committed
[WIP] Fix WIN32OLE deprecated constants warnings
1 parent 392c97e commit a65b6fb

38 files changed

+79
-82
lines changed

.mspec.constants

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,14 +220,11 @@ Vector
220220
WEBrick
221221
WIN32OLE
222222
WIN32OLEQueryInterfaceError
223-
WIN32OLERuntimeError
224223
WIN32OLE_EVENT
225-
WIN32OLE_METHOD
226224
WIN32OLE_PARAM
227225
WIN32OLE_RECORD
228226
WIN32OLE_RUBYSPEC
229227
WIN32OLE_TYPE
230-
WIN32OLE_TYPELIB
231228
WIN32OLE_VARIABLE
232229
WIN32OLE_VARIANT
233230
WeakRef

library/win32ole/fixtures/classes.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
require 'win32ole'
22

33
module WIN32OLESpecs
4-
MSXML_AVAILABLE = WIN32OLE_TYPELIB.typelibs.any? { |t| t.name.start_with?('Microsoft XML') }
5-
SYSTEM_MONITOR_CONTROL_AVAILABLE = WIN32OLE_TYPELIB.typelibs.any? { |t| t.name.start_with?('System Monitor Control') }
4+
MSXML_AVAILABLE = WIN32OLE::TypeLib.typelibs.any? { |t| t.name.start_with?('Microsoft XML') }
5+
SYSTEM_MONITOR_CONTROL_AVAILABLE = WIN32OLE::TypeLib.typelibs.any? { |t| t.name.start_with?('System Monitor Control') }
66

77
def self.new_ole(name)
88
tries = 0
99
begin
1010
WIN32OLE.new(name)
11-
rescue WIN32OLERuntimeError => e
11+
rescue WIN32OLE::RuntimeError => e
1212
if tries < 3
1313
tries += 1
1414
$stderr.puts "WIN32OLESpecs#new_ole retry (#{tries}): #{e.class}: #{e.message}"

library/win32ole/win32ole/locale_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@
1313
begin
1414
begin
1515
WIN32OLE.locale = 1041
16-
rescue WIN32OLERuntimeError
16+
rescue WIN32OLE::RuntimeError
1717
STDERR.puts("\n#{__FILE__}:#{__LINE__}:#{self.class.name}.test_s_locale_set is skipped(Japanese locale is not installed)")
1818
return
1919
end
2020

2121
WIN32OLE.locale.should == 1041
2222
WIN32OLE.locale = WIN32OLE::LOCALE_SYSTEM_DEFAULT
23-
-> { WIN32OLE.locale = 111 }.should raise_error WIN32OLERuntimeError
23+
-> { WIN32OLE.locale = 111 }.should raise_error WIN32OLE::RuntimeError
2424
WIN32OLE.locale.should == WIN32OLE::LOCALE_SYSTEM_DEFAULT
2525
ensure
2626
WIN32OLE.locale.should == WIN32OLE::LOCALE_SYSTEM_DEFAULT

library/win32ole/win32ole/new_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
-> { WIN32OLESpecs.new_ole(42) }.should raise_error( TypeError )
1818
end
1919

20-
it "raises WIN32OLERuntimeError if invalid string is given" do
21-
-> { WIN32OLE.new('foo') }.should raise_error( WIN32OLERuntimeError )
20+
it "raises WIN32OLE::RuntimeError if invalid string is given" do
21+
-> { WIN32OLE.new('foo') }.should raise_error( WIN32OLE::RuntimeError )
2222
end
2323

2424
end

library/win32ole/win32ole/ole_func_methods_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
-> { @dict.ole_func_methods(1) }.should raise_error ArgumentError
1212
end
1313

14-
it "returns an array of WIN32OLE_METHODs" do
15-
@dict.ole_func_methods.all? { |m| m.kind_of? WIN32OLE_METHOD }.should be_true
14+
it "returns an array of WIN32OLE::Methods" do
15+
@dict.ole_func_methods.all? { |m| m.kind_of? WIN32OLE::Method }.should be_true
1616
end
1717

1818
it "contains a 'AddRef' method for Scripting Dictionary" do

library/win32ole/win32ole/ole_get_methods_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
@win32ole = WIN32OLESpecs.new_ole('Shell.Application')
99
end
1010

11-
it "returns an array of WIN32OLE_METHOD objects" do
12-
@win32ole.ole_get_methods.all? {|m| m.kind_of? WIN32OLE_METHOD}.should be_true
11+
it "returns an array of WIN32OLE::Method objects" do
12+
@win32ole.ole_get_methods.all? {|m| m.kind_of? WIN32OLE::Method}.should be_true
1313
end
1414

1515
end

library/win32ole/win32ole/ole_methods_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
-> { @dict.ole_methods(1) }.should raise_error ArgumentError
1212
end
1313

14-
it "returns an array of WIN32OLE_METHODs" do
15-
@dict.ole_methods.all? { |m| m.kind_of? WIN32OLE_METHOD }.should be_true
14+
it "returns an array of WIN32OLE::Methods" do
15+
@dict.ole_methods.all? { |m| m.kind_of? WIN32OLE::Method }.should be_true
1616
end
1717

1818
it "contains a 'AddRef' method for Scripting Dictionary" do

library/win32ole/win32ole/ole_put_methods_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
-> { @dict.ole_put_methods(1) }.should raise_error ArgumentError
1212
end
1313

14-
it "returns an array of WIN32OLE_METHODs" do
15-
@dict.ole_put_methods.all? { |m| m.kind_of? WIN32OLE_METHOD }.should be_true
14+
it "returns an array of WIN32OLE::Methods" do
15+
@dict.ole_put_methods.all? { |m| m.kind_of? WIN32OLE::Method }.should be_true
1616
end
1717

1818
it "contains a 'Key' method for Scripting Dictionary" do

library/win32ole/win32ole/shared/ole_method.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
-> { @dict.send(@method) }.should raise_error ArgumentError
1111
end
1212

13-
it "returns the WIN32OLE_METHOD 'Add' if given 'Add'" do
13+
it "returns the WIN32OLE::Method 'Add' if given 'Add'" do
1414
result = @dict.send(@method, "Add")
15-
result.kind_of?(WIN32OLE_METHOD).should be_true
15+
result.kind_of?(WIN32OLE::Method).should be_true
1616
result.name.should == 'Add'
1717
end
1818
end

library/win32ole/win32ole_method/dispid_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
platform_is :windows do
33
require 'win32ole'
44

5-
describe "WIN32OLE_METHOD#dispid" do
5+
describe "WIN32OLE::Method#dispid" do
66
before :each do
77
ole_type = WIN32OLE_TYPE.new("Microsoft Shell Controls And Automation", "Shell")
8-
@m = WIN32OLE_METHOD.new(ole_type, "namespace")
8+
@m = WIN32OLE::Method.new(ole_type, "namespace")
99
end
1010

1111
it "raises ArgumentError if argument is given" do

0 commit comments

Comments
 (0)