diff options
Diffstat (limited to 'spec/ruby/library/win32ole')
82 files changed, 513 insertions, 466 deletions
diff --git a/spec/ruby/library/win32ole/fixtures/classes.rb b/spec/ruby/library/win32ole/fixtures/classes.rb index 830b1be0b5..5a16fcca45 100644 --- a/spec/ruby/library/win32ole/fixtures/classes.rb +++ b/spec/ruby/library/win32ole/fixtures/classes.rb @@ -1,14 +1,33 @@ +require 'win32ole' + +# win32ole deprecated constants like WIN32OLE_TYPELIB in Ruby 3.4 +# but only added the replacements like WIN32OLE::TypeLib in Ruby 3.4. +# So we use the new-style constants in specs to avoid deprecation warnings +# and we define the new-style constants as the old ones if they don't exist yet. +WIN32OLE::TypeLib ||= WIN32OLE_TYPELIB +WIN32OLE::RuntimeError ||= WIN32OLERuntimeError +WIN32OLE::Method ||= WIN32OLE_METHOD +WIN32OLE::Type ||= WIN32OLE_TYPE +WIN32OLE::Event ||= WIN32OLE_EVENT +WIN32OLE::Param ||= WIN32OLE_PARAM + module WIN32OLESpecs + 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') } + def self.new_ole(name) - retried = false + tries = 0 begin WIN32OLE.new(name) - rescue WIN32OLERuntimeError => e - unless retried - retried = true + rescue WIN32OLE::RuntimeError => e + if tries < 3 + tries += 1 + $stderr.puts "WIN32OLESpecs#new_ole retry (#{tries}): #{e.class}: #{e.message}" + sleep(2 ** tries) retry + else + raise end - raise e end end end diff --git a/spec/ruby/library/win32ole/fixtures/event.xml b/spec/ruby/library/win32ole/fixtures/event.xml new file mode 100644 index 0000000000..23f3d2b126 --- /dev/null +++ b/spec/ruby/library/win32ole/fixtures/event.xml @@ -0,0 +1,4 @@ +<program> + <name>Ruby</name> + <version>trunk</version> +</program> diff --git a/spec/ruby/library/win32ole/win32ole/_getproperty_spec.rb b/spec/ruby/library/win32ole/win32ole/_getproperty_spec.rb index 650a641f5b..52cb978bea 100644 --- a/spec/ruby/library/win32ole/win32ole/_getproperty_spec.rb +++ b/spec/ruby/library/win32ole/win32ole/_getproperty_spec.rb @@ -1,19 +1,15 @@ -require File.expand_path('../../fixtures/classes', __FILE__) - +require_relative "../../../spec_helper" platform_is :windows do - require 'win32ole' + require_relative '../fixtures/classes' describe "WIN32OLE#_getproperty" do before :each do - @ie = WIN32OLESpecs.new_ole('InternetExplorer.Application') - end - - after :each do - @ie.Quit + @dict = WIN32OLESpecs.new_ole('Scripting.Dictionary') end - it "gets name" do - @ie._getproperty(0, [], []).should =~ /explorer/i + it "gets value" do + @dict.add('key', 'value') + @dict._getproperty(0, ['key'], [WIN32OLE::VARIANT::VT_BSTR]).should == 'value' end end end diff --git a/spec/ruby/library/win32ole/win32ole/_invoke_spec.rb b/spec/ruby/library/win32ole/win32ole/_invoke_spec.rb index c2fe9a8490..747121aeba 100644 --- a/spec/ruby/library/win32ole/win32ole/_invoke_spec.rb +++ b/spec/ruby/library/win32ole/win32ole/_invoke_spec.rb @@ -1,7 +1,6 @@ -require File.expand_path('../../fixtures/classes', __FILE__) - +require_relative "../../../spec_helper" platform_is :windows do - require 'win32ole' + require_relative '../fixtures/classes' describe "WIN32OLE#_invoke" do before :each do @@ -9,9 +8,9 @@ platform_is :windows do end it "raises ArgumentError if insufficient number of arguments are given" do - lambda { @shell._invoke() }.should raise_error ArgumentError - lambda { @shell._invoke(0) }.should raise_error ArgumentError - lambda { @shell._invoke(0, []) }.should raise_error ArgumentError + -> { @shell._invoke() }.should.raise ArgumentError + -> { @shell._invoke(0) }.should.raise ArgumentError + -> { @shell._invoke(0, []) }.should.raise ArgumentError end it "dispatches the method bound to a specific ID" do diff --git a/spec/ruby/library/win32ole/win32ole/codepage_spec.rb b/spec/ruby/library/win32ole/win32ole/codepage_spec.rb index c84593871d..07e93646ac 100644 --- a/spec/ruby/library/win32ole/win32ole/codepage_spec.rb +++ b/spec/ruby/library/win32ole/win32ole/codepage_spec.rb @@ -1,7 +1,6 @@ -require File.expand_path('../../fixtures/classes', __FILE__) - +require_relative "../../../spec_helper" platform_is :windows do - require 'win32ole' + require_relative '../fixtures/classes' describe "WIN32OLE.codepage=" do it "sets codepage" do diff --git a/spec/ruby/library/win32ole/win32ole/connect_spec.rb b/spec/ruby/library/win32ole/win32ole/connect_spec.rb index ee480a727c..3a1caf85d3 100644 --- a/spec/ruby/library/win32ole/win32ole/connect_spec.rb +++ b/spec/ruby/library/win32ole/win32ole/connect_spec.rb @@ -1,16 +1,15 @@ -require File.expand_path('../../fixtures/classes', __FILE__) - +require_relative "../../../spec_helper" platform_is :windows do - require 'win32ole' + require_relative '../fixtures/classes' describe "WIN32OLE.connect" do it "creates WIN32OLE object given valid argument" do obj = WIN32OLE.connect("winmgmts:") - obj.should be_kind_of WIN32OLE + obj.should.is_a? WIN32OLE end it "raises TypeError when given invalid argument" do - lambda { WIN32OLE.connect 1 }.should raise_error TypeError + -> { WIN32OLE.connect 1 }.should.raise TypeError end end diff --git a/spec/ruby/library/win32ole/win32ole/const_load_spec.rb b/spec/ruby/library/win32ole/win32ole/const_load_spec.rb index a3c50f215e..b0ba023536 100644 --- a/spec/ruby/library/win32ole/win32ole/const_load_spec.rb +++ b/spec/ruby/library/win32ole/win32ole/const_load_spec.rb @@ -1,7 +1,6 @@ -require File.expand_path('../../fixtures/classes', __FILE__) - +require_relative "../../../spec_helper" platform_is :windows do - require 'win32ole' + require_relative '../fixtures/classes' describe "WIN32OLE.const_load when passed Shell.Application OLE object" do before :each do @@ -9,9 +8,9 @@ platform_is :windows do end it "loads constant SsfWINDOWS into WIN32OLE namespace" do - WIN32OLE.const_defined?(:SsfWINDOWS).should be_false + WIN32OLE.const_defined?(:SsfWINDOWS).should == false WIN32OLE.const_load @win32ole - WIN32OLE.const_defined?(:SsfWINDOWS).should be_true + WIN32OLE.const_defined?(:SsfWINDOWS).should == true end end @@ -24,9 +23,9 @@ platform_is :windows do it "loads constants into given namespace" do module WIN32OLE_RUBYSPEC; end - WIN32OLE_RUBYSPEC.const_defined?(:SsfWINDOWS).should be_false + WIN32OLE_RUBYSPEC.const_defined?(:SsfWINDOWS).should == false WIN32OLE.const_load @win32ole, WIN32OLE_RUBYSPEC - WIN32OLE_RUBYSPEC.const_defined?(:SsfWINDOWS).should be_true + WIN32OLE_RUBYSPEC.const_defined?(:SsfWINDOWS).should == true end end diff --git a/spec/ruby/library/win32ole/win32ole/constants_spec.rb b/spec/ruby/library/win32ole/win32ole/constants_spec.rb index 2a04511305..8533741440 100644 --- a/spec/ruby/library/win32ole/win32ole/constants_spec.rb +++ b/spec/ruby/library/win32ole/win32ole/constants_spec.rb @@ -1,7 +1,6 @@ -require File.expand_path('../../fixtures/classes', __FILE__) - +require_relative "../../../spec_helper" platform_is :windows do - require 'win32ole' + require_relative '../fixtures/classes' describe "WIN32OLE class" do it "defines constant CP_ACP" do diff --git a/spec/ruby/library/win32ole/win32ole/create_guid_spec.rb b/spec/ruby/library/win32ole/win32ole/create_guid_spec.rb index 17a7df10be..8aa853df9e 100644 --- a/spec/ruby/library/win32ole/win32ole/create_guid_spec.rb +++ b/spec/ruby/library/win32ole/win32ole/create_guid_spec.rb @@ -1,7 +1,6 @@ -require File.expand_path('../../fixtures/classes', __FILE__) - +require_relative "../../../spec_helper" platform_is :windows do - require 'win32ole' + require_relative '../fixtures/classes' describe "WIN32OLE.create_guid" do it "generates guid with valid format" do diff --git a/spec/ruby/library/win32ole/win32ole/invoke_spec.rb b/spec/ruby/library/win32ole/win32ole/invoke_spec.rb index 41752de359..d6ff7fade3 100644 --- a/spec/ruby/library/win32ole/win32ole/invoke_spec.rb +++ b/spec/ruby/library/win32ole/win32ole/invoke_spec.rb @@ -1,19 +1,15 @@ -require File.expand_path('../../fixtures/classes', __FILE__) - +require_relative "../../../spec_helper" platform_is :windows do - require 'win32ole' + require_relative '../fixtures/classes' describe "WIN32OLE#invoke" do before :each do - @ie = WIN32OLESpecs.new_ole('InternetExplorer.Application') - end - - after :each do - @ie.Quit + @dict = WIN32OLESpecs.new_ole('Scripting.Dictionary') end - it "get name by invoking 'Name' OLE method" do - @ie.invoke('Name').should =~ /explorer/i + it "get value by invoking 'Item' OLE method" do + @dict.add('key', 'value') + @dict.invoke('Item', 'key').should == 'value' end end end diff --git a/spec/ruby/library/win32ole/win32ole/locale_spec.rb b/spec/ruby/library/win32ole/win32ole/locale_spec.rb index 7cf4d9bc98..390c41d1a2 100644 --- a/spec/ruby/library/win32ole/win32ole/locale_spec.rb +++ b/spec/ruby/library/win32ole/win32ole/locale_spec.rb @@ -1,7 +1,6 @@ -require File.expand_path('../../fixtures/classes', __FILE__) - +require_relative "../../../spec_helper" platform_is :windows do - require 'win32ole' + require_relative '../fixtures/classes' describe "WIN32OLE.locale" do it "gets locale" do @@ -14,14 +13,14 @@ platform_is :windows do begin begin WIN32OLE.locale = 1041 - rescue WIN32OLERuntimeError + rescue WIN32OLE::RuntimeError STDERR.puts("\n#{__FILE__}:#{__LINE__}:#{self.class.name}.test_s_locale_set is skipped(Japanese locale is not installed)") return end WIN32OLE.locale.should == 1041 WIN32OLE.locale = WIN32OLE::LOCALE_SYSTEM_DEFAULT - lambda { WIN32OLE.locale = 111 }.should raise_error WIN32OLERuntimeError + -> { WIN32OLE.locale = 111 }.should.raise WIN32OLE::RuntimeError WIN32OLE.locale.should == WIN32OLE::LOCALE_SYSTEM_DEFAULT ensure WIN32OLE.locale.should == WIN32OLE::LOCALE_SYSTEM_DEFAULT diff --git a/spec/ruby/library/win32ole/win32ole/new_spec.rb b/spec/ruby/library/win32ole/win32ole/new_spec.rb index 78f141b608..4f54c724d9 100644 --- a/spec/ruby/library/win32ole/win32ole/new_spec.rb +++ b/spec/ruby/library/win32ole/win32ole/new_spec.rb @@ -1,25 +1,24 @@ -require File.expand_path('../../fixtures/classes', __FILE__) - +require_relative "../../../spec_helper" platform_is :windows do - require 'win32ole' + require_relative '../fixtures/classes' describe "WIN32OLESpecs.new_ole" do it "creates a WIN32OLE object from OLE server name" do shell = WIN32OLESpecs.new_ole 'Shell.Application' - shell.should be_kind_of WIN32OLE + shell.should.is_a? WIN32OLE end it "creates a WIN32OLE object from valid CLSID" do shell = WIN32OLESpecs.new_ole("{13709620-C279-11CE-A49E-444553540000}") - shell.should be_kind_of WIN32OLE + shell.should.is_a? WIN32OLE end it "raises TypeError if argument cannot be converted to String" do - lambda { WIN32OLESpecs.new_ole(42) }.should raise_error( TypeError ) + -> { WIN32OLESpecs.new_ole(42) }.should.raise( TypeError ) end - it "raises WIN32OLERuntimeError if invalid string is given" do - lambda { WIN32OLESpecs.new_ole('foo') }.should raise_error( WIN32OLERuntimeError ) + it "raises WIN32OLE::RuntimeError if invalid string is given" do + -> { WIN32OLE.new('foo') }.should.raise( WIN32OLE::RuntimeError ) end end diff --git a/spec/ruby/library/win32ole/win32ole/ole_func_methods_spec.rb b/spec/ruby/library/win32ole/win32ole/ole_func_methods_spec.rb index 82b5eb2680..33e3e23b1b 100644 --- a/spec/ruby/library/win32ole/win32ole/ole_func_methods_spec.rb +++ b/spec/ruby/library/win32ole/win32ole/ole_func_methods_spec.rb @@ -1,27 +1,22 @@ -require File.expand_path('../../fixtures/classes', __FILE__) - +require_relative "../../../spec_helper" platform_is :windows do - require 'win32ole' + require_relative '../fixtures/classes' describe "WIN32OLE#ole_func_methods" do before :each do - @ie = WIN32OLESpecs.new_ole('InternetExplorer.Application') - end - - after :each do - @ie.Quit + @dict = WIN32OLESpecs.new_ole('Scripting.Dictionary') end it "raises ArgumentError if argument is given" do - lambda { @ie.ole_func_methods(1) }.should raise_error ArgumentError + -> { @dict.ole_func_methods(1) }.should.raise ArgumentError end - it "returns an array of WIN32OLE_METHODs" do - @ie.ole_func_methods.all? { |m| m.kind_of? WIN32OLE_METHOD }.should be_true + it "returns an array of WIN32OLE::Methods" do + @dict.ole_func_methods.all? { |m| m.kind_of? WIN32OLE::Method }.should == true end - it "contains a 'AddRef' method for Internet Explorer" do - @ie.ole_func_methods.map { |m| m.name }.include?('AddRef').should be_true + it "contains a 'AddRef' method for Scripting Dictionary" do + @dict.ole_func_methods.map { |m| m.name }.include?('AddRef').should == true end end end diff --git a/spec/ruby/library/win32ole/win32ole/ole_get_methods_spec.rb b/spec/ruby/library/win32ole/win32ole/ole_get_methods_spec.rb index 3ec92d3efc..168a225d58 100644 --- a/spec/ruby/library/win32ole/win32ole/ole_get_methods_spec.rb +++ b/spec/ruby/library/win32ole/win32ole/ole_get_methods_spec.rb @@ -1,7 +1,6 @@ -require File.expand_path('../../fixtures/classes', __FILE__) - +require_relative "../../../spec_helper" platform_is :windows do - require 'win32ole' + require_relative '../fixtures/classes' describe "WIN32OLE#ole_get_methods" do @@ -9,8 +8,8 @@ platform_is :windows do @win32ole = WIN32OLESpecs.new_ole('Shell.Application') end - it "returns an array of WIN32OLE_METHOD objects" do - @win32ole.ole_get_methods.all? {|m| m.kind_of? WIN32OLE_METHOD}.should be_true + it "returns an array of WIN32OLE::Method objects" do + @win32ole.ole_get_methods.all? {|m| m.kind_of? WIN32OLE::Method}.should == true end end diff --git a/spec/ruby/library/win32ole/win32ole/ole_method_help_spec.rb b/spec/ruby/library/win32ole/win32ole/ole_method_help_spec.rb index 45b8e93eac..9cb3f9e6cf 100644 --- a/spec/ruby/library/win32ole/win32ole/ole_method_help_spec.rb +++ b/spec/ruby/library/win32ole/win32ole/ole_method_help_spec.rb @@ -1,8 +1,7 @@ -require File.expand_path('../../fixtures/classes', __FILE__) -require File.expand_path('../shared/ole_method', __FILE__) - +require_relative "../../../spec_helper" platform_is :windows do - require 'win32ole' + require_relative '../fixtures/classes' + require_relative 'shared/ole_method' describe "WIN32OLE#ole_method_help" do it_behaves_like :win32ole_ole_method, :ole_method_help diff --git a/spec/ruby/library/win32ole/win32ole/ole_method_spec.rb b/spec/ruby/library/win32ole/win32ole/ole_method_spec.rb index cb1d1d172b..e48ff8d905 100644 --- a/spec/ruby/library/win32ole/win32ole/ole_method_spec.rb +++ b/spec/ruby/library/win32ole/win32ole/ole_method_spec.rb @@ -1,8 +1,7 @@ -require File.expand_path('../../fixtures/classes', __FILE__) -require File.expand_path('../shared/ole_method', __FILE__) - +require_relative "../../../spec_helper" platform_is :windows do - require 'win32ole' + require_relative '../fixtures/classes' + require_relative 'shared/ole_method' describe "WIN32OLE#ole_method" do it_behaves_like :win32ole_ole_method, :ole_method diff --git a/spec/ruby/library/win32ole/win32ole/ole_methods_spec.rb b/spec/ruby/library/win32ole/win32ole/ole_methods_spec.rb index bba2aa73ae..5152deeaf4 100644 --- a/spec/ruby/library/win32ole/win32ole/ole_methods_spec.rb +++ b/spec/ruby/library/win32ole/win32ole/ole_methods_spec.rb @@ -1,27 +1,22 @@ -require File.expand_path('../../fixtures/classes', __FILE__) - +require_relative "../../../spec_helper" platform_is :windows do - require 'win32ole' + require_relative '../fixtures/classes' describe "WIN32OLE#ole_methods" do before :each do - @ie = WIN32OLESpecs.new_ole('InternetExplorer.Application') - end - - after :each do - @ie.Quit + @dict = WIN32OLESpecs.new_ole('Scripting.Dictionary') end it "raises ArgumentError if argument is given" do - lambda { @ie.ole_methods(1) }.should raise_error ArgumentError + -> { @dict.ole_methods(1) }.should.raise ArgumentError end - it "returns an array of WIN32OLE_METHODs" do - @ie.ole_methods.all? { |m| m.kind_of? WIN32OLE_METHOD }.should be_true + it "returns an array of WIN32OLE::Methods" do + @dict.ole_methods.all? { |m| m.kind_of? WIN32OLE::Method }.should == true end - it "contains a 'AddRef' method for Internet Explorer" do - @ie.ole_methods.map { |m| m.name }.include?('AddRef').should be_true + it "contains a 'AddRef' method for Scripting Dictionary" do + @dict.ole_methods.map { |m| m.name }.include?('AddRef').should == true end end end diff --git a/spec/ruby/library/win32ole/win32ole/ole_obj_help_spec.rb b/spec/ruby/library/win32ole/win32ole/ole_obj_help_spec.rb index eede93bb87..1478804b55 100644 --- a/spec/ruby/library/win32ole/win32ole/ole_obj_help_spec.rb +++ b/spec/ruby/library/win32ole/win32ole/ole_obj_help_spec.rb @@ -1,23 +1,19 @@ -require File.expand_path('../../fixtures/classes', __FILE__) +require_relative "../../../spec_helper" platform_is :windows do - require 'win32ole' + require_relative '../fixtures/classes' describe "WIN32OLE#ole_obj_help" do before :each do - @ie = WIN32OLESpecs.new_ole('InternetExplorer.Application') - end - - after :each do - @ie.Quit + @dict = WIN32OLESpecs.new_ole('Scripting.Dictionary') end it "raises ArgumentError if argument is given" do - lambda { @ie.ole_obj_help(1) }.should raise_error ArgumentError + -> { @dict.ole_obj_help(1) }.should.raise ArgumentError end - it "returns an instance of WIN32OLE_TYPE" do - @ie.ole_obj_help.kind_of?(WIN32OLE_TYPE).should be_true + it "returns an instance of WIN32OLE::Type" do + @dict.ole_obj_help.kind_of?(WIN32OLE::Type).should == true end end end diff --git a/spec/ruby/library/win32ole/win32ole/ole_put_methods_spec.rb b/spec/ruby/library/win32ole/win32ole/ole_put_methods_spec.rb index 5334e7a47d..b03a5d4b06 100644 --- a/spec/ruby/library/win32ole/win32ole/ole_put_methods_spec.rb +++ b/spec/ruby/library/win32ole/win32ole/ole_put_methods_spec.rb @@ -1,27 +1,22 @@ -require File.expand_path('../../fixtures/classes', __FILE__) - +require_relative "../../../spec_helper" platform_is :windows do - require 'win32ole' + require_relative '../fixtures/classes' describe "WIN32OLE#ole_put_methods" do before :each do - @ie = WIN32OLESpecs.new_ole('InternetExplorer.Application') - end - - after :each do - @ie.Quit + @dict = WIN32OLESpecs.new_ole('Scripting.Dictionary') end it "raises ArgumentError if argument is given" do - lambda { @ie.ole_put_methods(1) }.should raise_error ArgumentError + -> { @dict.ole_put_methods(1) }.should.raise ArgumentError end - it "returns an array of WIN32OLE_METHODs" do - @ie.ole_put_methods.all? { |m| m.kind_of? WIN32OLE_METHOD }.should be_true + it "returns an array of WIN32OLE::Methods" do + @dict.ole_put_methods.all? { |m| m.kind_of? WIN32OLE::Method }.should == true end - it "contains a 'Height' method for Internet Explorer" do - @ie.ole_put_methods.map { |m| m.name }.include?('Height').should be_true + it "contains a 'Key' method for Scripting Dictionary" do + @dict.ole_put_methods.map { |m| m.name }.include?('Key').should == true end end end diff --git a/spec/ruby/library/win32ole/win32ole/setproperty_spec.rb b/spec/ruby/library/win32ole/win32ole/setproperty_spec.rb index ae08e63f78..bacdee63da 100644 --- a/spec/ruby/library/win32ole/win32ole/setproperty_spec.rb +++ b/spec/ruby/library/win32ole/win32ole/setproperty_spec.rb @@ -1,8 +1,7 @@ -require File.expand_path('../../fixtures/classes', __FILE__) -require File.expand_path('../shared/setproperty', __FILE__) - +require_relative "../../../spec_helper" platform_is :windows do - require 'win32ole' + require_relative '../fixtures/classes' + require_relative 'shared/setproperty' describe "WIN32OLE#setproperty" do it_behaves_like :win32ole_setproperty, :setproperty diff --git a/spec/ruby/library/win32ole/win32ole/shared/ole_method.rb b/spec/ruby/library/win32ole/win32ole/shared/ole_method.rb index 668000c1fc..9e4b7e7c20 100644 --- a/spec/ruby/library/win32ole/win32ole/shared/ole_method.rb +++ b/spec/ruby/library/win32ole/win32ole/shared/ole_method.rb @@ -1,25 +1,19 @@ -require File.expand_path('../../../fixtures/classes', __FILE__) - platform_is :windows do - require 'win32ole' + require_relative '../../fixtures/classes' describe :win32ole_ole_method, shared: true do before :each do - @ie = WIN32OLESpecs.new_ole('InternetExplorer.Application') - end - - after :each do - @ie.Quit + @dict = WIN32OLESpecs.new_ole('Scripting.Dictionary') end it "raises ArgumentError if no argument is given" do - lambda { @ie.send(@method) }.should raise_error ArgumentError + -> { @dict.send(@method) }.should.raise ArgumentError end - it "returns the WIN32OLE_METHOD 'Quit' if given 'Quit'" do - result = @ie.send(@method, "Quit") - result.kind_of?(WIN32OLE_METHOD).should be_true - result.name.should == 'Quit' + it "returns the WIN32OLE::Method 'Add' if given 'Add'" do + result = @dict.send(@method, "Add") + result.kind_of?(WIN32OLE::Method).should == true + result.name.should == 'Add' end end end diff --git a/spec/ruby/library/win32ole/win32ole/shared/setproperty.rb b/spec/ruby/library/win32ole/win32ole/shared/setproperty.rb index 9703e402bf..de3ad7b286 100644 --- a/spec/ruby/library/win32ole/win32ole/shared/setproperty.rb +++ b/spec/ruby/library/win32ole/win32ole/shared/setproperty.rb @@ -1,25 +1,23 @@ -require File.expand_path('../../../fixtures/classes', __FILE__) - platform_is :windows do - require 'win32ole' + require_relative '../../fixtures/classes' describe :win32ole_setproperty, shared: true do before :each do - @ie = WIN32OLESpecs.new_ole('InternetExplorer.Application') - end - - after :each do - @ie.Quit + @dict = WIN32OLESpecs.new_ole('Scripting.Dictionary') end it "raises ArgumentError if no argument is given" do - lambda { @ie.send(@method) }.should raise_error ArgumentError + -> { @dict.send(@method) }.should.raise ArgumentError end - it "sets height to 500 and returns nil" do - height = 500 - result = @ie.send(@method, 'Height', height) + it "sets key to newkey and returns nil" do + oldkey = 'oldkey' + newkey = 'newkey' + @dict.add(oldkey, 'value') + result = @dict.send(@method, 'Key', oldkey, newkey) result.should == nil + @dict[oldkey].should == nil + @dict[newkey].should == 'value' end end end diff --git a/spec/ruby/library/win32ole/win32ole_event/new_spec.rb b/spec/ruby/library/win32ole/win32ole_event/new_spec.rb index 5fffac535e..d09c38b78d 100644 --- a/spec/ruby/library/win32ole/win32ole_event/new_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_event/new_spec.rb @@ -1,33 +1,34 @@ -require File.expand_path('../../fixtures/classes', __FILE__) - +require_relative "../../../spec_helper" platform_is :windows do - require 'win32ole' + require_relative '../fixtures/classes' - describe "WIN32OLE_EVENT.new" do - before :each do - @ie = WIN32OLESpecs.new_ole('InternetExplorer.Application') - end + guard -> { WIN32OLESpecs::MSXML_AVAILABLE } do + describe "WIN32OLE::Event.new" do + before :all do + @xml_dom = WIN32OLESpecs.new_ole('MSXML.DOMDocument') + end - after :each do - @ie.Quit if @ie - end + after :all do + @xml_dom = nil + end - it "raises TypeError given invalid argument" do - lambda { WIN32OLE_EVENT.new "A" }.should raise_error TypeError - end + it "raises TypeError given invalid argument" do + -> { WIN32OLE::Event.new "A" }.should.raise TypeError + end - it "raises RuntimeError if event does not exist" do - lambda { WIN32OLE_EVENT.new(@ie, 'A') }.should raise_error RuntimeError - end + it "raises RuntimeError if event does not exist" do + -> { WIN32OLE::Event.new(@xml_dom, 'A') }.should.raise RuntimeError + end - it "raises RuntimeError if OLE object has no events" do - dict = WIN32OLESpecs.new_ole('Scripting.Dictionary') - lambda { WIN32OLE_EVENT.new(dict) }.should raise_error RuntimeError - end + it "raises RuntimeError if OLE object has no events" do + dict = WIN32OLESpecs.new_ole('Scripting.Dictionary') + -> { WIN32OLE::Event.new(dict) }.should.raise RuntimeError + end - it "creates WIN32OLE_EVENT object" do - ev = WIN32OLE_EVENT.new(@ie, 'DWebBrowserEvents') - ev.should be_kind_of WIN32OLE_EVENT + it "creates WIN32OLE::Event object" do + ev = WIN32OLE::Event.new(@xml_dom) + ev.should.is_a? WIN32OLE::Event + end end end end diff --git a/spec/ruby/library/win32ole/win32ole_event/on_event_spec.rb b/spec/ruby/library/win32ole/win32ole_event/on_event_spec.rb index 6bf8d2e1da..acc7d2d6b6 100644 --- a/spec/ruby/library/win32ole/win32ole_event/on_event_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_event/on_event_spec.rb @@ -1,62 +1,71 @@ -require File.expand_path('../../fixtures/classes', __FILE__) - +require_relative "../../../spec_helper" platform_is :windows do - require 'win32ole' + require_relative '../fixtures/classes' + guard -> { WIN32OLESpecs::MSXML_AVAILABLE } do - def default_handler(event, *args) - @event += event - end + def handler_global(event, *args) + @event_global += event + end - def alternate_handler(event, *args) - @event2 = "alternate" - end + def handler_specific(*args) + @event_specific = "specific" + end - def handler3(event, *args) - @event3 += event - end + def handler_spec_alt(*args) + @event_spec_alt = "spec_alt" + end + describe "WIN32OLE::Event#on_event" do + before :all do + @fn_xml = File.absolute_path "../fixtures/event.xml", __dir__ + end - describe "WIN32OLE_EVENT#on_event with no argument" do - before :each do - @ie = WIN32OLESpecs.new_ole('InternetExplorer.Application') - @ev = WIN32OLE_EVENT.new(@ie, 'DWebBrowserEvents') - @event = '' - @event2 = '' - @event3 = '' - @ie.StatusBar = true - end + before :each do + @xml_dom = WIN32OLESpecs.new_ole 'MSXML.DOMDocument' + @xml_dom.async = true + @ev = WIN32OLE::Event.new @xml_dom + @event_global = '' + @event_specific = '' + @event_spec_alt = '' + end - after :each do - @ie.Quit - end + after :each do + @xml_dom = nil + @ev = nil + end - it "sets event handler properly, and the handler is invoked by event loop" do - @ev.on_event { |*args| default_handler(*args) } - @ie.StatusText='hello' - WIN32OLE_EVENT.message_loop - @event.should =~ /StatusTextChange/ - end + it "sets global event handler properly, and the handler is invoked by event loop" do + @ev.on_event { |*args| handler_global(*args) } + @xml_dom.loadXML "<program><name>Ruby</name><version>trunk</version></program>" + WIN32OLE::Event.message_loop + @event_global.should =~ /onreadystatechange/ + end - it "accepts a String argument, sets event handler properly, and the handler is invoked by event loop" do - @ev.on_event("StatusTextChange") { |*args| @event = 'foo' } - @ie.StatusText='hello' - WIN32OLE_EVENT.message_loop - @event.should =~ /foo/ - end + it "accepts a String argument and the handler is invoked by event loop" do + @ev.on_event("onreadystatechange") { |*args| @event = 'foo' } + @xml_dom.loadXML "<program><name>Ruby</name><version>trunk</version></program>" + WIN32OLE::Event.message_loop + @event.should =~ /foo/ + end - it "registers multiple event handlers for the same event" do - @ev.on_event("StatusTextChange") { |*args| default_handler(*args) } - @ev.on_event("StatusTextChange") { |*args| alternate_handler(*args) } - @ie.StatusText= 'hello' - WIN32OLE_EVENT.message_loop - @event2.should == 'alternate' - end + it "accepts a Symbol argument and the handler is invoked by event loop" do + @ev.on_event(:onreadystatechange) { |*args| @event = 'bar' } + @xml_dom.loadXML "<program><name>Ruby</name><version>trunk</version></program>" + WIN32OLE::Event.message_loop + @event.should =~ /bar/ + end - it "accepts a Symbol argument, sets event handler properly, and the handler is invoked by event loop" do - @ev.on_event(:StatusTextChange) { |*args| @event = 'foo' } - @ie.StatusText='hello' - WIN32OLE_EVENT.message_loop - @event.should =~ /foo/ + it "accepts a specific event handler and overrides a global event handler" do + @ev.on_event { |*args| handler_global(*args) } + @ev.on_event("onreadystatechange") { |*args| handler_specific(*args) } + @ev.on_event("onreadystatechange") { |*args| handler_spec_alt(*args) } + @xml_dom.load @fn_xml + WIN32OLE::Event.message_loop + @event_global.should == 'ondataavailable' + @event_global.should_not =~ /onreadystatechange/ + @event_specific.should == '' + @event_spec_alt.should == "spec_alt" + end end end end diff --git a/spec/ruby/library/win32ole/win32ole_method/dispid_spec.rb b/spec/ruby/library/win32ole/win32ole_method/dispid_spec.rb index 840cdf72b8..43084eb943 100644 --- a/spec/ruby/library/win32ole/win32ole_method/dispid_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_method/dispid_spec.rb @@ -1,14 +1,15 @@ +require_relative "../../../spec_helper" platform_is :windows do require 'win32ole' - describe "WIN32OLE_METHOD#dispid" do + describe "WIN32OLE::Method#dispid" do before :each do - ole_type = WIN32OLE_TYPE.new("Microsoft Shell Controls And Automation", "Shell") - @m = WIN32OLE_METHOD.new(ole_type, "namespace") + ole_type = WIN32OLE::Type.new("Microsoft Shell Controls And Automation", "Shell") + @m = WIN32OLE::Method.new(ole_type, "namespace") end it "raises ArgumentError if argument is given" do - lambda { @m.dispid(0) }.should raise_error ArgumentError + -> { @m.dispid(0) }.should.raise ArgumentError end it "returns expected dispatch ID for Shell's 'namespace' method" do diff --git a/spec/ruby/library/win32ole/win32ole_method/event_interface_spec.rb b/spec/ruby/library/win32ole/win32ole_method/event_interface_spec.rb index 9d3ca2b8e4..1d00fb9696 100644 --- a/spec/ruby/library/win32ole/win32ole_method/event_interface_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_method/event_interface_spec.rb @@ -1,26 +1,29 @@ +require_relative "../../../spec_helper" platform_is :windows do - require 'win32ole' + require_relative '../fixtures/classes' + guard -> { WIN32OLESpecs::SYSTEM_MONITOR_CONTROL_AVAILABLE } do - describe "WIN32OLE_METHOD#event_interface" do - before :each do - ole_type = WIN32OLE_TYPE.new("Microsoft Internet Controls", "WebBrowser") - @navigate_method = WIN32OLE_METHOD.new(ole_type, "NavigateComplete") - ole_type = WIN32OLE_TYPE.new("Microsoft Shell Controls And Automation", "Shell") - @namespace_method = WIN32OLE_METHOD.new(ole_type, "namespace") - end + describe "WIN32OLE::Method#event_interface" do + before :each do + ole_type = WIN32OLE::Type.new("System Monitor Control", "SystemMonitor") + @on_dbl_click_method = WIN32OLE::Method.new(ole_type, "OnDblClick") + ole_type = WIN32OLE::Type.new("Microsoft Shell Controls And Automation", "Shell") + @namespace_method = WIN32OLE::Method.new(ole_type, "namespace") + end - it "raises ArgumentError if argument is given" do - lambda { @navigate_method.event_interface(1) }.should raise_error ArgumentError - end + it "raises ArgumentError if argument is given" do + -> { @on_dbl_click_method.event_interface(1) }.should.raise ArgumentError + end - it "returns expected string for browser's 'NavigateComplete' method" do - @navigate_method.event_interface.should == "DWebBrowserEvents" - end + it "returns expected string for System Monitor Control's 'OnDblClick' method" do + @on_dbl_click_method.event_interface.should == "DISystemMonitorEvents" + end - it "returns nil if method has no event interface" do - @namespace_method.event_interface.should be_nil - end + it "returns nil if method has no event interface" do + @namespace_method.event_interface.should == nil + end + end end end diff --git a/spec/ruby/library/win32ole/win32ole_method/event_spec.rb b/spec/ruby/library/win32ole/win32ole_method/event_spec.rb index 25435438aa..fd611519cb 100644 --- a/spec/ruby/library/win32ole/win32ole_method/event_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_method/event_spec.rb @@ -1,20 +1,23 @@ +require_relative "../../../spec_helper" platform_is :windows do - require 'win32ole' + require_relative '../fixtures/classes' + guard -> { WIN32OLESpecs::SYSTEM_MONITOR_CONTROL_AVAILABLE } do - describe "WIN32OLE_METHOD#event?" do - before :each do - ole_type = WIN32OLE_TYPE.new("Microsoft Internet Controls", "WebBrowser") - @navigate_method = WIN32OLE_METHOD.new(ole_type, "NavigateComplete") - end + describe "WIN32OLE::Method#event?" do + before :each do + ole_type = WIN32OLE::Type.new("System Monitor Control", "SystemMonitor") + @on_dbl_click_method = WIN32OLE::Method.new(ole_type, "OnDblClick") + end - it "raises ArgumentError if argument is given" do - lambda { @navigate_method.event?(1) }.should raise_error ArgumentError - end + it "raises ArgumentError if argument is given" do + -> { @on_dbl_click_method.event?(1) }.should.raise ArgumentError + end - it "returns true for browser's 'NavigateComplete' method" do - @navigate_method.event?.should be_true - end + it "returns true for System Monitor Control's 'OnDblClick' method" do + @on_dbl_click_method.event?.should == true + end + end end end diff --git a/spec/ruby/library/win32ole/win32ole_method/helpcontext_spec.rb b/spec/ruby/library/win32ole/win32ole_method/helpcontext_spec.rb index c0e66a7a18..88164bcd1f 100644 --- a/spec/ruby/library/win32ole/win32ole_method/helpcontext_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_method/helpcontext_spec.rb @@ -1,20 +1,21 @@ +require_relative "../../../spec_helper" platform_is :windows do require 'win32ole' - describe "WIN32OLE_METHOD#helpcontext" do + describe "WIN32OLE::Method#helpcontext" do before :each do - ole_type = WIN32OLE_TYPE.new("Microsoft Internet Controls", "WebBrowser") - @navigate_method = WIN32OLE_METHOD.new(ole_type, "NavigateComplete") - ole_type = WIN32OLE_TYPE.new("Microsoft Scripting Runtime", "File") - @m_file_name = WIN32OLE_METHOD.new(ole_type, "name") + ole_type = WIN32OLE::Type.new("Microsoft Scripting Runtime", "FileSystemObject") + @get_file_version = WIN32OLE::Method.new(ole_type, "GetFileVersion") + ole_type = WIN32OLE::Type.new("Microsoft Scripting Runtime", "File") + @m_file_name = WIN32OLE::Method.new(ole_type, "name") end it "raises ArgumentError if argument is given" do - lambda { @navigate_method.helpcontext(1) }.should raise_error ArgumentError + -> { @get_file_version.helpcontext(1) }.should.raise ArgumentError end - it "returns expected value for browser's 'NavigateComplete' method" do - @navigate_method.helpcontext.should == 0 + it "returns expected value for FileSystemObject's 'GetFileVersion' method" do + @get_file_version.helpcontext.should == 0 end it "returns expected value for Scripting Runtime's 'name' method" do diff --git a/spec/ruby/library/win32ole/win32ole_method/helpfile_spec.rb b/spec/ruby/library/win32ole/win32ole_method/helpfile_spec.rb index 72cc4da16b..314f58c062 100644 --- a/spec/ruby/library/win32ole/win32ole_method/helpfile_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_method/helpfile_spec.rb @@ -1,14 +1,15 @@ +require_relative "../../../spec_helper" platform_is :windows do require 'win32ole' - describe "WIN32OLE_METHOD#helpfile" do + describe "WIN32OLE::Method#helpfile" do before :each do - ole_type = WIN32OLE_TYPE.new("Microsoft Scripting Runtime", "File") - @m_file_name = WIN32OLE_METHOD.new(ole_type, "name") + ole_type = WIN32OLE::Type.new("Microsoft Scripting Runtime", "File") + @m_file_name = WIN32OLE::Method.new(ole_type, "name") end it "raises ArgumentError if argument is given" do - lambda { @m_file_name.helpfile(1) }.should raise_error ArgumentError + -> { @m_file_name.helpfile(1) }.should.raise ArgumentError end it "returns expected value for Scripting Runtime's 'File' method" do diff --git a/spec/ruby/library/win32ole/win32ole_method/helpstring_spec.rb b/spec/ruby/library/win32ole/win32ole_method/helpstring_spec.rb index 60105d0aa2..2a93acdb37 100644 --- a/spec/ruby/library/win32ole/win32ole_method/helpstring_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_method/helpstring_spec.rb @@ -1,14 +1,15 @@ +require_relative "../../../spec_helper" platform_is :windows do require 'win32ole' - describe "WIN32OLE_METHOD#helpstring" do + describe "WIN32OLE::Method#helpstring" do before :each do - ole_type = WIN32OLE_TYPE.new("Microsoft Scripting Runtime", "File") - @m_file_name = WIN32OLE_METHOD.new(ole_type, "name") + ole_type = WIN32OLE::Type.new("Microsoft Scripting Runtime", "File") + @m_file_name = WIN32OLE::Method.new(ole_type, "name") end it "raises ArgumentError if argument is given" do - lambda { @m_file_name.helpstring(1) }.should raise_error ArgumentError + -> { @m_file_name.helpstring(1) }.should.raise ArgumentError end it "returns expected value for Scripting Runtime's 'File' method" do diff --git a/spec/ruby/library/win32ole/win32ole_method/invkind_spec.rb b/spec/ruby/library/win32ole/win32ole_method/invkind_spec.rb index cf0a74bbce..16e5412a36 100644 --- a/spec/ruby/library/win32ole/win32ole_method/invkind_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_method/invkind_spec.rb @@ -1,14 +1,15 @@ +require_relative "../../../spec_helper" platform_is :windows do require 'win32ole' - describe "WIN32OLE_METHOD#invkind" do + describe "WIN32OLE::Method#invkind" do before :each do - ole_type = WIN32OLE_TYPE.new("Microsoft Scripting Runtime", "File") - @m_file_name = WIN32OLE_METHOD.new(ole_type, "name") + ole_type = WIN32OLE::Type.new("Microsoft Scripting Runtime", "File") + @m_file_name = WIN32OLE::Method.new(ole_type, "name") end it "raises ArgumentError if argument is given" do - lambda { @m_file_name.invkind(1) }.should raise_error ArgumentError + -> { @m_file_name.invkind(1) }.should.raise ArgumentError end it "returns expected value for Scripting Runtime's 'name' method" do diff --git a/spec/ruby/library/win32ole/win32ole_method/invoke_kind_spec.rb b/spec/ruby/library/win32ole/win32ole_method/invoke_kind_spec.rb index 4d2af8fb0c..312860a9c5 100644 --- a/spec/ruby/library/win32ole/win32ole_method/invoke_kind_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_method/invoke_kind_spec.rb @@ -1,14 +1,15 @@ +require_relative "../../../spec_helper" platform_is :windows do require 'win32ole' - describe "WIN32OLE_METHOD#invoke_kind" do + describe "WIN32OLE::Method#invoke_kind" do before :each do - ole_type = WIN32OLE_TYPE.new("Microsoft Scripting Runtime", "File") - @m_file_name = WIN32OLE_METHOD.new(ole_type, "name") + ole_type = WIN32OLE::Type.new("Microsoft Scripting Runtime", "File") + @m_file_name = WIN32OLE::Method.new(ole_type, "name") end it "raises ArgumentError if argument is given" do - lambda { @m_file_name.invoke_kind(1) }.should raise_error ArgumentError + -> { @m_file_name.invoke_kind(1) }.should.raise ArgumentError end it "returns expected value for Scripting Runtime's 'name' method" do diff --git a/spec/ruby/library/win32ole/win32ole_method/name_spec.rb b/spec/ruby/library/win32ole/win32ole_method/name_spec.rb index 0c2b3eeba0..6e2e233a62 100644 --- a/spec/ruby/library/win32ole/win32ole_method/name_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_method/name_spec.rb @@ -1,9 +1,10 @@ -require File.expand_path('../shared/name', __FILE__) +require_relative "../../../spec_helper" +require_relative 'shared/name' platform_is :windows do require 'win32ole' - describe "WIN32OLE_METHOD#name" do + describe "WIN32OLE::Method#name" do it_behaves_like :win32ole_method_name, :name end diff --git a/spec/ruby/library/win32ole/win32ole_method/new_spec.rb b/spec/ruby/library/win32ole/win32ole_method/new_spec.rb index f904107c6c..d805d80128 100644 --- a/spec/ruby/library/win32ole/win32ole_method/new_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_method/new_spec.rb @@ -1,31 +1,32 @@ +require_relative "../../../spec_helper" platform_is :windows do require 'win32ole' - describe "WIN32OLE_METHOD.new" do + describe "WIN32OLE::Method.new" do before :each do - @ole_type = WIN32OLE_TYPE.new("Microsoft Shell Controls And Automation", "Shell") + @ole_type = WIN32OLE::Type.new("Microsoft Shell Controls And Automation", "Shell") end it "raises TypeError when given non-strings" do - lambda { WIN32OLE_METHOD.new(1, 2) }.should raise_error TypeError + -> { WIN32OLE::Method.new(1, 2) }.should.raise TypeError end it "raises ArgumentError if only 1 argument is given" do - lambda { WIN32OLE_METHOD.new("hello") }.should raise_error ArgumentError - lambda { WIN32OLE_METHOD.new(@ole_type) }.should raise_error ArgumentError + -> { WIN32OLE::Method.new("hello") }.should.raise ArgumentError + -> { WIN32OLE::Method.new(@ole_type) }.should.raise ArgumentError end - it "returns a valid WIN32OLE_METHOD object" do - WIN32OLE_METHOD.new(@ole_type, "Open").should be_kind_of WIN32OLE_METHOD - WIN32OLE_METHOD.new(@ole_type, "open").should be_kind_of WIN32OLE_METHOD + it "returns a valid WIN32OLE::Method object" do + WIN32OLE::Method.new(@ole_type, "Open").should.is_a? WIN32OLE::Method + WIN32OLE::Method.new(@ole_type, "open").should.is_a? WIN32OLE::Method end - it "raises WIN32OLERuntimeError if the method does not exist" do - lambda { WIN32OLE_METHOD.new(@ole_type, "NonexistentMethod") }.should raise_error WIN32OLERuntimeError + it "raises WIN32OLE::RuntimeError if the method does not exist" do + -> { WIN32OLE::Method.new(@ole_type, "NonexistentMethod") }.should.raise WIN32OLE::RuntimeError end it "raises TypeError if second argument is not a String" do - lambda { WIN32OLE_METHOD.new(@ole_type, 5) }.should raise_error TypeError + -> { WIN32OLE::Method.new(@ole_type, 5) }.should.raise TypeError end end diff --git a/spec/ruby/library/win32ole/win32ole_method/offset_vtbl_spec.rb b/spec/ruby/library/win32ole/win32ole_method/offset_vtbl_spec.rb index e436441409..7c7e49ff3a 100644 --- a/spec/ruby/library/win32ole/win32ole_method/offset_vtbl_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_method/offset_vtbl_spec.rb @@ -1,18 +1,19 @@ +require_relative "../../../spec_helper" platform_is :windows do require 'win32ole' - describe "WIN32OLE_METHOD#offset_vtbl" do + describe "WIN32OLE::Method#offset_vtbl" do before :each do - ole_type = WIN32OLE_TYPE.new("Microsoft Scripting Runtime", "File") - @m_file_name = WIN32OLE_METHOD.new(ole_type, "name") + ole_type = WIN32OLE::Type.new("Microsoft Scripting Runtime", "File") + @m_file_name = WIN32OLE::Method.new(ole_type, "name") end it "raises ArgumentError if argument is given" do - lambda { @m_file_name.offset_vtbl(1) }.should raise_error ArgumentError + -> { @m_file_name.offset_vtbl(1) }.should.raise ArgumentError end it "returns expected value for Scripting Runtime's 'name' method" do - pointer_size = RUBY_PLATFORM =~ /\bx64\b/ ? 64 : 1.size * 8 + pointer_size = PlatformGuard::POINTER_SIZE @m_file_name.offset_vtbl.should == pointer_size end diff --git a/spec/ruby/library/win32ole/win32ole_method/params_spec.rb b/spec/ruby/library/win32ole/win32ole_method/params_spec.rb index 08c7f04bdd..40a543fa55 100644 --- a/spec/ruby/library/win32ole/win32ole_method/params_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_method/params_spec.rb @@ -1,25 +1,26 @@ +require_relative "../../../spec_helper" platform_is :windows do require 'win32ole' - describe "WIN32OLE_METHOD#params" do + describe "WIN32OLE::Method#params" do before :each do - ole_type = WIN32OLE_TYPE.new("Microsoft Scripting Runtime", "File") - @m_file_name = WIN32OLE_METHOD.new(ole_type, "name") - ole_type = WIN32OLE_TYPE.new("Microsoft Shell Controls And Automation", "Shell") - @m_browse_for_folder = WIN32OLE_METHOD.new(ole_type, "BrowseForFolder") + ole_type = WIN32OLE::Type.new("Microsoft Scripting Runtime", "File") + @m_file_name = WIN32OLE::Method.new(ole_type, "name") + ole_type = WIN32OLE::Type.new("Microsoft Shell Controls And Automation", "Shell") + @m_browse_for_folder = WIN32OLE::Method.new(ole_type, "BrowseForFolder") end it "raises ArgumentError if argument is given" do - lambda { @m_file_name.params(1) }.should raise_error ArgumentError + -> { @m_file_name.params(1) }.should.raise ArgumentError end it "returns empty array for Scripting Runtime's 'name' method" do - @m_file_name.params.should be_kind_of Array - @m_file_name.params.should be_empty + @m_file_name.params.should.is_a? Array + @m_file_name.params.should.empty? end - it "returns 4-element array of WIN32OLE_PARAM for Shell's 'BrowseForFolder' method" do - @m_browse_for_folder.params.all? { |p| p.kind_of? WIN32OLE_PARAM }.should be_true + it "returns 4-element array of WIN32OLE::Param for Shell's 'BrowseForFolder' method" do + @m_browse_for_folder.params.all? { |p| p.kind_of? WIN32OLE::Param }.should == true @m_browse_for_folder.params.size == 4 end diff --git a/spec/ruby/library/win32ole/win32ole_method/return_type_detail_spec.rb b/spec/ruby/library/win32ole/win32ole_method/return_type_detail_spec.rb index b8f2bbe084..6d46c705c6 100644 --- a/spec/ruby/library/win32ole/win32ole_method/return_type_detail_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_method/return_type_detail_spec.rb @@ -1,18 +1,19 @@ +require_relative "../../../spec_helper" platform_is :windows do require 'win32ole' - describe "WIN32OLE_METHOD#return_type_detail" do + describe "WIN32OLE::Method#return_type_detail" do before :each do - ole_type = WIN32OLE_TYPE.new("Microsoft Shell Controls And Automation", "Shell") - @m_browse_for_folder = WIN32OLE_METHOD.new(ole_type, "BrowseForFolder") + ole_type = WIN32OLE::Type.new("Microsoft Shell Controls And Automation", "Shell") + @m_browse_for_folder = WIN32OLE::Method.new(ole_type, "BrowseForFolder") end it "raises ArgumentError if argument is given" do - lambda { @m_browse_for_folder.return_type_detail(1) }.should raise_error ArgumentError + -> { @m_browse_for_folder.return_type_detail(1) }.should.raise ArgumentError end it "returns expected value for Shell Control's 'BrowseForFolder' method" do - @m_browse_for_folder.return_type_detail.should be_kind_of Array + @m_browse_for_folder.return_type_detail.should.is_a? Array @m_browse_for_folder.return_type_detail.should == ['PTR', 'USERDEFINED', 'Folder'] end diff --git a/spec/ruby/library/win32ole/win32ole_method/return_type_spec.rb b/spec/ruby/library/win32ole/win32ole_method/return_type_spec.rb index b68481fe59..5afaf202f2 100644 --- a/spec/ruby/library/win32ole/win32ole_method/return_type_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_method/return_type_spec.rb @@ -1,14 +1,15 @@ +require_relative "../../../spec_helper" platform_is :windows do require 'win32ole' - describe "WIN32OLE_METHOD#return_type" do + describe "WIN32OLE::Method#return_type" do before :each do - ole_type = WIN32OLE_TYPE.new("Microsoft Scripting Runtime", "File") - @m_file_name = WIN32OLE_METHOD.new(ole_type, "name") + ole_type = WIN32OLE::Type.new("Microsoft Scripting Runtime", "File") + @m_file_name = WIN32OLE::Method.new(ole_type, "name") end it "raises ArgumentError if argument is given" do - lambda { @m_file_name.return_type(1) }.should raise_error ArgumentError + -> { @m_file_name.return_type(1) }.should.raise ArgumentError end it "returns expected value for Scripting Runtime's 'name' method" do diff --git a/spec/ruby/library/win32ole/win32ole_method/return_vtype_spec.rb b/spec/ruby/library/win32ole/win32ole_method/return_vtype_spec.rb index f236de01f9..882b5eaf43 100644 --- a/spec/ruby/library/win32ole/win32ole_method/return_vtype_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_method/return_vtype_spec.rb @@ -1,14 +1,15 @@ +require_relative "../../../spec_helper" platform_is :windows do require 'win32ole' - describe "WIN32OLE_METHOD#return_vtype" do + describe "WIN32OLE::Method#return_vtype" do before :each do - ole_type = WIN32OLE_TYPE.new("Microsoft Shell Controls And Automation", "Shell") - @m_browse_for_folder = WIN32OLE_METHOD.new(ole_type, "BrowseForFolder") + ole_type = WIN32OLE::Type.new("Microsoft Shell Controls And Automation", "Shell") + @m_browse_for_folder = WIN32OLE::Method.new(ole_type, "BrowseForFolder") end it "raises ArgumentError if argument is given" do - lambda { @m_browse_for_folder.return_vtype(1) }.should raise_error ArgumentError + -> { @m_browse_for_folder.return_vtype(1) }.should.raise ArgumentError end it "returns expected value for Shell Control's 'BrowseForFolder' method" do diff --git a/spec/ruby/library/win32ole/win32ole_method/shared/name.rb b/spec/ruby/library/win32ole/win32ole_method/shared/name.rb index 2be6478a6e..ef63999836 100644 --- a/spec/ruby/library/win32ole/win32ole_method/shared/name.rb +++ b/spec/ruby/library/win32ole/win32ole_method/shared/name.rb @@ -3,12 +3,12 @@ platform_is :windows do describe :win32ole_method_name, shared: true do before :each do - ole_type = WIN32OLE_TYPE.new("Microsoft Scripting Runtime", "File") - @m_file_name = WIN32OLE_METHOD.new(ole_type, "name") + ole_type = WIN32OLE::Type.new("Microsoft Scripting Runtime", "File") + @m_file_name = WIN32OLE::Method.new(ole_type, "name") end it "raises ArgumentError if argument is given" do - lambda { @m_file_name.send(@method, 1) }.should raise_error ArgumentError + -> { @m_file_name.send(@method, 1) }.should.raise ArgumentError end it "returns expected value for Scripting Runtime's 'name' method" do diff --git a/spec/ruby/library/win32ole/win32ole_method/size_opt_params_spec.rb b/spec/ruby/library/win32ole/win32ole_method/size_opt_params_spec.rb index a63c50474c..e03a97c6c0 100644 --- a/spec/ruby/library/win32ole/win32ole_method/size_opt_params_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_method/size_opt_params_spec.rb @@ -1,14 +1,15 @@ +require_relative "../../../spec_helper" platform_is :windows do require 'win32ole' - describe "WIN32OLE_METHOD#size_opt_params" do + describe "WIN32OLE::Method#size_opt_params" do before :each do - ole_type = WIN32OLE_TYPE.new("Microsoft Shell Controls And Automation", "Shell") - @m_browse_for_folder = WIN32OLE_METHOD.new(ole_type, "BrowseForFolder") + ole_type = WIN32OLE::Type.new("Microsoft Shell Controls And Automation", "Shell") + @m_browse_for_folder = WIN32OLE::Method.new(ole_type, "BrowseForFolder") end it "raises ArgumentError if argument is given" do - lambda { @m_browse_for_folder.size_opt_params(1) }.should raise_error ArgumentError + -> { @m_browse_for_folder.size_opt_params(1) }.should.raise ArgumentError end it "returns expected value for Shell Control's 'BrowseForFolder' method" do diff --git a/spec/ruby/library/win32ole/win32ole_method/size_params_spec.rb b/spec/ruby/library/win32ole/win32ole_method/size_params_spec.rb index fe93d5bc66..f64f77af46 100644 --- a/spec/ruby/library/win32ole/win32ole_method/size_params_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_method/size_params_spec.rb @@ -1,14 +1,15 @@ +require_relative "../../../spec_helper" platform_is :windows do require 'win32ole' - describe "WIN32OLE_METHOD#size_params" do + describe "WIN32OLE::Method#size_params" do before :each do - ole_type = WIN32OLE_TYPE.new("Microsoft Shell Controls And Automation", "Shell") - @m_browse_for_folder = WIN32OLE_METHOD.new(ole_type, "BrowseForFolder") + ole_type = WIN32OLE::Type.new("Microsoft Shell Controls And Automation", "Shell") + @m_browse_for_folder = WIN32OLE::Method.new(ole_type, "BrowseForFolder") end it "raises ArgumentError if argument is given" do - lambda { @m_browse_for_folder.size_params(1) }.should raise_error ArgumentError + -> { @m_browse_for_folder.size_params(1) }.should.raise ArgumentError end it "returns expected value for Shell Control's 'BrowseForFolder' method" do diff --git a/spec/ruby/library/win32ole/win32ole_method/to_s_spec.rb b/spec/ruby/library/win32ole/win32ole_method/to_s_spec.rb index 95fd2fcdb5..cdcc4525b1 100644 --- a/spec/ruby/library/win32ole/win32ole_method/to_s_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_method/to_s_spec.rb @@ -1,9 +1,10 @@ -require File.expand_path('../shared/name', __FILE__) +require_relative "../../../spec_helper" +require_relative 'shared/name' platform_is :windows do require 'win32ole' - describe "WIN32OLE_METHOD#name" do + describe "WIN32OLE::Method#name" do it_behaves_like :win32ole_method_name, :to_s end diff --git a/spec/ruby/library/win32ole/win32ole_method/visible_spec.rb b/spec/ruby/library/win32ole/win32ole_method/visible_spec.rb index b49fac6066..a04ac6570b 100644 --- a/spec/ruby/library/win32ole/win32ole_method/visible_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_method/visible_spec.rb @@ -1,18 +1,19 @@ +require_relative "../../../spec_helper" platform_is :windows do require 'win32ole' - describe "WIN32OLE_METHOD#visible?" do + describe "WIN32OLE::Method#visible?" do before :each do - ole_type = WIN32OLE_TYPE.new("Microsoft Shell Controls And Automation", "Shell") - @m_browse_for_folder = WIN32OLE_METHOD.new(ole_type, "BrowseForFolder") + ole_type = WIN32OLE::Type.new("Microsoft Shell Controls And Automation", "Shell") + @m_browse_for_folder = WIN32OLE::Method.new(ole_type, "BrowseForFolder") end it "raises ArgumentError if argument is given" do - lambda { @m_browse_for_folder.visible?(1) }.should raise_error ArgumentError + -> { @m_browse_for_folder.visible?(1) }.should.raise ArgumentError end it "returns true for Shell Control's 'BrowseForFolder' method" do - @m_browse_for_folder.visible?.should be_true + @m_browse_for_folder.visible?.should == true end end diff --git a/spec/ruby/library/win32ole/win32ole_param/default_spec.rb b/spec/ruby/library/win32ole/win32ole_param/default_spec.rb index 7a1337ec7c..dded6833d4 100644 --- a/spec/ruby/library/win32ole/win32ole_param/default_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_param/default_spec.rb @@ -1,24 +1,25 @@ +require_relative "../../../spec_helper" platform_is :windows do require 'win32ole' - describe "WIN32OLE_PARAM#default" do + describe "WIN32OLE::Param#default" do before :each do - ole_type = WIN32OLE_TYPE.new("Microsoft Shell Controls And Automation", "Shell") - m_browse_for_folder = WIN32OLE_METHOD.new(ole_type, "BrowseForFolder") + ole_type = WIN32OLE::Type.new("Microsoft Shell Controls And Automation", "Shell") + m_browse_for_folder = WIN32OLE::Method.new(ole_type, "BrowseForFolder") @params = m_browse_for_folder.params - ole_type = WIN32OLE_TYPE.new("Microsoft Scripting Runtime", "FileSystemObject") - m_copyfile = WIN32OLE_METHOD.new(ole_type, "CopyFile") + ole_type = WIN32OLE::Type.new("Microsoft Scripting Runtime", "FileSystemObject") + m_copyfile = WIN32OLE::Method.new(ole_type, "CopyFile") @param_overwritefiles = m_copyfile.params[2] end it "raises ArgumentError if argument is given" do - lambda { @params[0].default(1) }.should raise_error ArgumentError + -> { @params[0].default(1) }.should.raise ArgumentError end - it "returns nil for each of WIN32OLE_PARAM for Shell's 'BrowseForFolder' method" do + it "returns nil for each of WIN32OLE::Param for Shell's 'BrowseForFolder' method" do @params.each do |p| - p.default.should be_nil + p.default.should == nil end end diff --git a/spec/ruby/library/win32ole/win32ole_param/input_spec.rb b/spec/ruby/library/win32ole/win32ole_param/input_spec.rb index bdf4bccc79..46dc305d2b 100644 --- a/spec/ruby/library/win32ole/win32ole_param/input_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_param/input_spec.rb @@ -1,19 +1,20 @@ +require_relative "../../../spec_helper" platform_is :windows do require 'win32ole' - describe "WIN32OLE_PARAM#input?" do + describe "WIN32OLE::Param#input?" do before :each do - ole_type = WIN32OLE_TYPE.new("Microsoft Scripting Runtime", "FileSystemObject") - m_copyfile = WIN32OLE_METHOD.new(ole_type, "CopyFile") + ole_type = WIN32OLE::Type.new("Microsoft Scripting Runtime", "FileSystemObject") + m_copyfile = WIN32OLE::Method.new(ole_type, "CopyFile") @param_overwritefiles = m_copyfile.params[2] end it "raises ArgumentError if argument is given" do - lambda { @param_overwritefiles.input?(1) }.should raise_error ArgumentError + -> { @param_overwritefiles.input?(1) }.should.raise ArgumentError end it "returns true for 3rd parameter of FileSystemObject's 'CopyFile' method" do - @param_overwritefiles.input?.should == true + @param_overwritefiles.should.input? end end diff --git a/spec/ruby/library/win32ole/win32ole_param/name_spec.rb b/spec/ruby/library/win32ole/win32ole_param/name_spec.rb index b3c947d6fb..2c3474ffb3 100644 --- a/spec/ruby/library/win32ole/win32ole_param/name_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_param/name_spec.rb @@ -1,9 +1,10 @@ -require File.expand_path('../shared/name', __FILE__) +require_relative "../../../spec_helper" +require_relative 'shared/name' platform_is :windows do require 'win32ole' - describe "WIN32OLE_PARAM#name" do + describe "WIN32OLE::Param#name" do it_behaves_like :win32ole_param_name, :name end diff --git a/spec/ruby/library/win32ole/win32ole_param/ole_type_detail_spec.rb b/spec/ruby/library/win32ole/win32ole_param/ole_type_detail_spec.rb index 3ba51c02f1..bd25ec325a 100644 --- a/spec/ruby/library/win32ole/win32ole_param/ole_type_detail_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_param/ole_type_detail_spec.rb @@ -1,15 +1,16 @@ +require_relative "../../../spec_helper" platform_is :windows do require 'win32ole' - describe "WIN32OLE_PARAM#ole_type_detail" do + describe "WIN32OLE::Param#ole_type_detail" do before :each do - ole_type_detail = WIN32OLE_TYPE.new("Microsoft Scripting Runtime", "FileSystemObject") - m_copyfile = WIN32OLE_METHOD.new(ole_type_detail, "CopyFile") + ole_type_detail = WIN32OLE::Type.new("Microsoft Scripting Runtime", "FileSystemObject") + m_copyfile = WIN32OLE::Method.new(ole_type_detail, "CopyFile") @param_overwritefiles = m_copyfile.params[2] end it "raises ArgumentError if argument is given" do - lambda { @param_overwritefiles.ole_type_detail(1) }.should raise_error ArgumentError + -> { @param_overwritefiles.ole_type_detail(1) }.should.raise ArgumentError end it "returns ['BOOL'] for 3rd parameter of FileSystemObject's 'CopyFile' method" do diff --git a/spec/ruby/library/win32ole/win32ole_param/ole_type_spec.rb b/spec/ruby/library/win32ole/win32ole_param/ole_type_spec.rb index 52bee2c9b8..3f0c279316 100644 --- a/spec/ruby/library/win32ole/win32ole_param/ole_type_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_param/ole_type_spec.rb @@ -1,15 +1,16 @@ +require_relative "../../../spec_helper" platform_is :windows do require 'win32ole' - describe "WIN32OLE_PARAM#ole_type" do + describe "WIN32OLE::Param#ole_type" do before :each do - ole_type = WIN32OLE_TYPE.new("Microsoft Scripting Runtime", "FileSystemObject") - m_copyfile = WIN32OLE_METHOD.new(ole_type, "CopyFile") + ole_type = WIN32OLE::Type.new("Microsoft Scripting Runtime", "FileSystemObject") + m_copyfile = WIN32OLE::Method.new(ole_type, "CopyFile") @param_overwritefiles = m_copyfile.params[2] end it "raises ArgumentError if argument is given" do - lambda { @param_overwritefiles.ole_type(1) }.should raise_error ArgumentError + -> { @param_overwritefiles.ole_type(1) }.should.raise ArgumentError end it "returns 'BOOL' for 3rd parameter of FileSystemObject's 'CopyFile' method" do diff --git a/spec/ruby/library/win32ole/win32ole_param/optional_spec.rb b/spec/ruby/library/win32ole/win32ole_param/optional_spec.rb index 2476df8641..ca676e0950 100644 --- a/spec/ruby/library/win32ole/win32ole_param/optional_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_param/optional_spec.rb @@ -1,19 +1,20 @@ +require_relative "../../../spec_helper" platform_is :windows do require 'win32ole' - describe "WIN32OLE_PARAM#optional?" do + describe "WIN32OLE::Param#optional?" do before :each do - ole_type_detail = WIN32OLE_TYPE.new("Microsoft Scripting Runtime", "FileSystemObject") - m_copyfile = WIN32OLE_METHOD.new(ole_type_detail, "CopyFile") + ole_type_detail = WIN32OLE::Type.new("Microsoft Scripting Runtime", "FileSystemObject") + m_copyfile = WIN32OLE::Method.new(ole_type_detail, "CopyFile") @param_overwritefiles = m_copyfile.params[2] end it "raises ArgumentError if argument is given" do - lambda { @param_overwritefiles.optional?(1) }.should raise_error ArgumentError + -> { @param_overwritefiles.optional?(1) }.should.raise ArgumentError end it "returns true for 3rd parameter of FileSystemObject's 'CopyFile' method" do - @param_overwritefiles.optional?.should be_true + @param_overwritefiles.optional?.should == true end end diff --git a/spec/ruby/library/win32ole/win32ole_param/retval_spec.rb b/spec/ruby/library/win32ole/win32ole_param/retval_spec.rb index 90946c0774..f25b1e7e14 100644 --- a/spec/ruby/library/win32ole/win32ole_param/retval_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_param/retval_spec.rb @@ -1,19 +1,20 @@ +require_relative "../../../spec_helper" platform_is :windows do require 'win32ole' - describe "WIN32OLE_PARAM#retval?" do + describe "WIN32OLE::Param#retval?" do before :each do - ole_type_detail = WIN32OLE_TYPE.new("Microsoft Scripting Runtime", "FileSystemObject") - m_copyfile = WIN32OLE_METHOD.new(ole_type_detail, "CopyFile") + ole_type_detail = WIN32OLE::Type.new("Microsoft Scripting Runtime", "FileSystemObject") + m_copyfile = WIN32OLE::Method.new(ole_type_detail, "CopyFile") @param_overwritefiles = m_copyfile.params[2] end it "raises ArgumentError if argument is given" do - lambda { @param_overwritefiles.retval?(1) }.should raise_error ArgumentError + -> { @param_overwritefiles.retval?(1) }.should.raise ArgumentError end it "returns false for 3rd parameter of FileSystemObject's 'CopyFile' method" do - @param_overwritefiles.retval?.should be_false + @param_overwritefiles.retval?.should == false end end diff --git a/spec/ruby/library/win32ole/win32ole_param/shared/name.rb b/spec/ruby/library/win32ole/win32ole_param/shared/name.rb index b7892d92fb..1f6cbea7a0 100644 --- a/spec/ruby/library/win32ole/win32ole_param/shared/name.rb +++ b/spec/ruby/library/win32ole/win32ole_param/shared/name.rb @@ -3,13 +3,13 @@ platform_is :windows do describe :win32ole_param_name, shared: true do before :each do - ole_type_detail = WIN32OLE_TYPE.new("Microsoft Scripting Runtime", "FileSystemObject") - m_copyfile = WIN32OLE_METHOD.new(ole_type_detail, "CopyFile") + ole_type_detail = WIN32OLE::Type.new("Microsoft Scripting Runtime", "FileSystemObject") + m_copyfile = WIN32OLE::Method.new(ole_type_detail, "CopyFile") @param_overwritefiles = m_copyfile.params[2] end it "raises ArgumentError if argument is given" do - lambda { @param_overwritefiles.send(@method, 1) }.should raise_error ArgumentError + -> { @param_overwritefiles.send(@method, 1) }.should.raise ArgumentError end it "returns expected value for Scripting Runtime's 'name' method" do diff --git a/spec/ruby/library/win32ole/win32ole_param/to_s_spec.rb b/spec/ruby/library/win32ole/win32ole_param/to_s_spec.rb index 7852bb0494..c59f426692 100644 --- a/spec/ruby/library/win32ole/win32ole_param/to_s_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_param/to_s_spec.rb @@ -1,9 +1,10 @@ -require File.expand_path('../shared/name', __FILE__) +require_relative "../../../spec_helper" +require_relative 'shared/name' platform_is :windows do require 'win32ole' - describe "WIN32OLE_PARAM#to_s" do + describe "WIN32OLE::Param#to_s" do it_behaves_like :win32ole_param_name, :to_s end diff --git a/spec/ruby/library/win32ole/win32ole_type/guid_spec.rb b/spec/ruby/library/win32ole/win32ole_type/guid_spec.rb index 25907c8e32..e574a945ad 100644 --- a/spec/ruby/library/win32ole/win32ole_type/guid_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_type/guid_spec.rb @@ -1,9 +1,10 @@ +require_relative "../../../spec_helper" platform_is :windows do require 'win32ole' - describe "WIN32OLE_TYPE#guid for Shell Controls" do + describe "WIN32OLE::Type#guid for Shell Controls" do before :each do - @ole_type = WIN32OLE_TYPE.new("Microsoft Shell Controls And Automation", "Shell") + @ole_type = WIN32OLE::Type.new("Microsoft Shell Controls And Automation", "Shell") end after :each do diff --git a/spec/ruby/library/win32ole/win32ole_type/helpcontext_spec.rb b/spec/ruby/library/win32ole/win32ole_type/helpcontext_spec.rb index d436835188..7b605a038b 100644 --- a/spec/ruby/library/win32ole/win32ole_type/helpcontext_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_type/helpcontext_spec.rb @@ -1,9 +1,10 @@ +require_relative "../../../spec_helper" platform_is :windows do require 'win32ole' - describe "WIN32OLE_TYPE#helpcontext for Shell Controls" do + describe "WIN32OLE::Type#helpcontext for Shell Controls" do before :each do - @ole_type = WIN32OLE_TYPE.new("Microsoft Shell Controls And Automation", "Shell") + @ole_type = WIN32OLE::Type.new("Microsoft Shell Controls And Automation", "Shell") end after :each do @@ -11,7 +12,7 @@ platform_is :windows do end it "returns an Integer" do - @ole_type.helpcontext.should be_kind_of Integer + @ole_type.helpcontext.should.is_a? Integer end end diff --git a/spec/ruby/library/win32ole/win32ole_type/helpfile_spec.rb b/spec/ruby/library/win32ole/win32ole_type/helpfile_spec.rb index 01e6945138..43a979882a 100644 --- a/spec/ruby/library/win32ole/win32ole_type/helpfile_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_type/helpfile_spec.rb @@ -1,9 +1,10 @@ +require_relative "../../../spec_helper" platform_is :windows do require 'win32ole' - describe "WIN32OLE_TYPE#helpfile for Shell Controls" do + describe "WIN32OLE::Type#helpfile for Shell Controls" do before :each do - @ole_type = WIN32OLE_TYPE.new("Microsoft Shell Controls And Automation", "Shell") + @ole_type = WIN32OLE::Type.new("Microsoft Shell Controls And Automation", "Shell") end after :each do @@ -11,7 +12,7 @@ platform_is :windows do end it "returns an empty string" do - @ole_type.helpfile.should be_empty + @ole_type.helpfile.should.empty? end end diff --git a/spec/ruby/library/win32ole/win32ole_type/helpstring_spec.rb b/spec/ruby/library/win32ole/win32ole_type/helpstring_spec.rb index 3bd2cbe5dd..940475b25e 100644 --- a/spec/ruby/library/win32ole/win32ole_type/helpstring_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_type/helpstring_spec.rb @@ -1,9 +1,10 @@ +require_relative "../../../spec_helper" platform_is :windows do require 'win32ole' - describe "WIN32OLE_TYPE#helpstring for Shell Controls" do + describe "WIN32OLE::Type#helpstring for Shell Controls" do before :each do - @ole_type = WIN32OLE_TYPE.new("Microsoft Shell Controls And Automation", "Shell") + @ole_type = WIN32OLE::Type.new("Microsoft Shell Controls And Automation", "Shell") end after :each do diff --git a/spec/ruby/library/win32ole/win32ole_type/major_version_spec.rb b/spec/ruby/library/win32ole/win32ole_type/major_version_spec.rb index 7dae16617d..66fdbc9ab0 100644 --- a/spec/ruby/library/win32ole/win32ole_type/major_version_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_type/major_version_spec.rb @@ -1,9 +1,10 @@ +require_relative "../../../spec_helper" platform_is :windows do require 'win32ole' - describe "WIN32OLE_TYPE#major_version for Shell Controls" do + describe "WIN32OLE::Type#major_version for Shell Controls" do before :each do - @ole_type = WIN32OLE_TYPE.new("Microsoft Shell Controls And Automation", "Shell") + @ole_type = WIN32OLE::Type.new("Microsoft Shell Controls And Automation", "Shell") end after :each do @@ -11,7 +12,7 @@ platform_is :windows do end it "returns an Integer" do - @ole_type.major_version.should be_kind_of Integer + @ole_type.major_version.should.is_a? Integer end end diff --git a/spec/ruby/library/win32ole/win32ole_type/minor_version_spec.rb b/spec/ruby/library/win32ole/win32ole_type/minor_version_spec.rb index ff412dd100..afb5086565 100644 --- a/spec/ruby/library/win32ole/win32ole_type/minor_version_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_type/minor_version_spec.rb @@ -1,9 +1,10 @@ +require_relative "../../../spec_helper" platform_is :windows do require 'win32ole' - describe "WIN32OLE_TYPE#minor_version for Shell Controls" do + describe "WIN32OLE::Type#minor_version for Shell Controls" do before :each do - @ole_type = WIN32OLE_TYPE.new("Microsoft Shell Controls And Automation", "Shell") + @ole_type = WIN32OLE::Type.new("Microsoft Shell Controls And Automation", "Shell") end after :each do @@ -11,7 +12,7 @@ platform_is :windows do end it "returns an Integer" do - @ole_type.minor_version.should be_kind_of Integer + @ole_type.minor_version.should.is_a? Integer end end diff --git a/spec/ruby/library/win32ole/win32ole_type/name_spec.rb b/spec/ruby/library/win32ole/win32ole_type/name_spec.rb index b395cf05d5..4cc3426872 100644 --- a/spec/ruby/library/win32ole/win32ole_type/name_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_type/name_spec.rb @@ -1,9 +1,10 @@ -require File.expand_path('../shared/name', __FILE__) +require_relative "../../../spec_helper" +require_relative 'shared/name' platform_is :windows do require 'win32ole' - describe "WIN32OLE_TYPE#name" do + describe "WIN32OLE::Type#name" do it_behaves_like :win32ole_type_name, :name end diff --git a/spec/ruby/library/win32ole/win32ole_type/new_spec.rb b/spec/ruby/library/win32ole/win32ole_type/new_spec.rb index 9443a64c75..9d92177a4b 100644 --- a/spec/ruby/library/win32ole/win32ole_type/new_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_type/new_spec.rb @@ -1,36 +1,40 @@ +require_relative "../../../spec_helper" platform_is :windows do require 'win32ole' - describe "WIN32OLE_TYPE.new" do + describe "WIN32OLE::Type.new" do it "raises ArgumentError with no argument" do - lambda { WIN32OLE_TYPE.new }.should raise_error ArgumentError + -> { WIN32OLE::Type.new }.should.raise ArgumentError end it "raises ArgumentError with invalid string" do - lambda { WIN32OLE_TYPE.new("foo") }.should raise_error ArgumentError + -> { WIN32OLE::Type.new("foo") }.should.raise ArgumentError end it "raises TypeError if second argument is not a String" do - lambda { WIN32OLE_TYPE.new(1,2) }.should raise_error TypeError - lambda { WIN32OLE_TYPE.new('Microsoft Shell Controls And Automation',2) }. - should raise_error TypeError + -> { WIN32OLE::Type.new(1,2) }.should.raise TypeError + -> { + WIN32OLE::Type.new('Microsoft Shell Controls And Automation',2) + }.should.raise TypeError end - it "raise WIN32OLERuntimeError if OLE object specified is not found" do - lambda { WIN32OLE_TYPE.new('Microsoft Shell Controls And Automation','foo') }. - should raise_error WIN32OLERuntimeError - lambda { WIN32OLE_TYPE.new('Microsoft Shell Controls And Automation','Application') }. - should raise_error WIN32OLERuntimeError + it "raise WIN32OLE::RuntimeError if OLE object specified is not found" do + -> { + WIN32OLE::Type.new('Microsoft Shell Controls And Automation','foo') + }.should.raise WIN32OLE::RuntimeError + -> { + WIN32OLE::Type.new('Microsoft Shell Controls And Automation','Application') + }.should.raise WIN32OLE::RuntimeError end - it "creates WIN32OLE_TYPE object from name and valid type" do - ole_type = WIN32OLE_TYPE.new("Microsoft Shell Controls And Automation", "Shell") - ole_type.should be_kind_of WIN32OLE_TYPE + it "creates WIN32OLE::Type object from name and valid type" do + ole_type = WIN32OLE::Type.new("Microsoft Shell Controls And Automation", "Shell") + ole_type.should.is_a? WIN32OLE::Type end - it "creates WIN32OLE_TYPE object from CLSID and valid type" do - ole_type2 = WIN32OLE_TYPE.new("{13709620-C279-11CE-A49E-444553540000}", "Shell") - ole_type2.should be_kind_of WIN32OLE_TYPE + it "creates WIN32OLE::Type object from CLSID and valid type" do + ole_type2 = WIN32OLE::Type.new("{13709620-C279-11CE-A49E-444553540000}", "Shell") + ole_type2.should.is_a? WIN32OLE::Type end end diff --git a/spec/ruby/library/win32ole/win32ole_type/ole_classes_spec.rb b/spec/ruby/library/win32ole/win32ole_type/ole_classes_spec.rb index 0ce0fc98a4..7db08dc900 100644 --- a/spec/ruby/library/win32ole/win32ole_type/ole_classes_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_type/ole_classes_spec.rb @@ -1,9 +1,10 @@ +require_relative "../../../spec_helper" platform_is :windows do require 'win32ole' - describe "WIN32OLE_TYPE.ole_classes for Shell Controls" do + describe "WIN32OLE::Type.ole_classes for Shell Controls" do before :each do - @ole_type = WIN32OLE_TYPE.new("Microsoft Shell Controls And Automation", "Shell") + @ole_type = WIN32OLE::Type.new("Microsoft Shell Controls And Automation", "Shell") end after :each do @@ -11,7 +12,7 @@ platform_is :windows do end it "returns array of WIN32OLE_TYPEs" do - WIN32OLE_TYPE.ole_classes("Microsoft Shell Controls And Automation").all? {|e| e.kind_of? WIN32OLE_TYPE }.should be_true + WIN32OLE::Type.ole_classes("Microsoft Shell Controls And Automation").all? {|e| e.kind_of? WIN32OLE::Type }.should == true end end diff --git a/spec/ruby/library/win32ole/win32ole_type/ole_methods_spec.rb b/spec/ruby/library/win32ole/win32ole_type/ole_methods_spec.rb index 9265549d20..bdf668e53b 100644 --- a/spec/ruby/library/win32ole/win32ole_type/ole_methods_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_type/ole_methods_spec.rb @@ -1,9 +1,10 @@ +require_relative "../../../spec_helper" platform_is :windows do require 'win32ole' - describe "WIN32OLE_TYPE#ole_methods for Shell Controls" do + describe "WIN32OLE::Type#ole_methods for Shell Controls" do before :each do - @ole_type = WIN32OLE_TYPE.new("Microsoft Shell Controls And Automation", "Shell") + @ole_type = WIN32OLE::Type.new("Microsoft Shell Controls And Automation", "Shell") end after :each do @@ -11,7 +12,7 @@ platform_is :windows do end it "returns an Integer" do - @ole_type.ole_methods.all? { |m| m.kind_of? WIN32OLE_METHOD }.should be_true + @ole_type.ole_methods.all? { |m| m.kind_of? WIN32OLE::Method }.should == true end end diff --git a/spec/ruby/library/win32ole/win32ole_type/ole_type_spec.rb b/spec/ruby/library/win32ole/win32ole_type/ole_type_spec.rb index 2bc19aa85e..49c1902f8c 100644 --- a/spec/ruby/library/win32ole/win32ole_type/ole_type_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_type/ole_type_spec.rb @@ -1,9 +1,10 @@ +require_relative "../../../spec_helper" platform_is :windows do require 'win32ole' - describe "WIN32OLE_TYPE#ole_type for Shell Controls" do + describe "WIN32OLE::Type#ole_type for Shell Controls" do before :each do - @ole_type = WIN32OLE_TYPE.new("Microsoft Shell Controls And Automation", "Shell") + @ole_type = WIN32OLE::Type.new("Microsoft Shell Controls And Automation", "Shell") end after :each do diff --git a/spec/ruby/library/win32ole/win32ole_type/progid_spec.rb b/spec/ruby/library/win32ole/win32ole_type/progid_spec.rb index f0d80ba39e..9a700426d9 100644 --- a/spec/ruby/library/win32ole/win32ole_type/progid_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_type/progid_spec.rb @@ -1,9 +1,10 @@ +require_relative "../../../spec_helper" platform_is :windows do require 'win32ole' - describe "WIN32OLE_TYPE#progid for Shell Controls" do + describe "WIN32OLE::Type#progid for Shell Controls" do before :each do - @ole_type = WIN32OLE_TYPE.new("Microsoft Shell Controls And Automation", "Shell") + @ole_type = WIN32OLE::Type.new("Microsoft Shell Controls And Automation", "Shell") end after :each do diff --git a/spec/ruby/library/win32ole/win32ole_type/progids_spec.rb b/spec/ruby/library/win32ole/win32ole_type/progids_spec.rb index 0cdd3514e3..cbb9247da1 100644 --- a/spec/ruby/library/win32ole/win32ole_type/progids_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_type/progids_spec.rb @@ -1,13 +1,14 @@ +require_relative "../../../spec_helper" platform_is :windows do require 'win32ole' - describe "WIN32OLE_TYPE.progids" do + describe "WIN32OLE::Type.progids" do it "raises ArgumentError if an argument is given" do - lambda { WIN32OLE_TYPE.progids(1) }.should raise_error ArgumentError + -> { WIN32OLE::Type.progids(1) }.should.raise ArgumentError end it "returns an array containing 'Shell.Explorer'" do - WIN32OLE_TYPE.progids().include?('Shell.Explorer').should be_true + WIN32OLE::Type.progids().include?('Shell.Explorer').should == true end end diff --git a/spec/ruby/library/win32ole/win32ole_type/shared/name.rb b/spec/ruby/library/win32ole/win32ole_type/shared/name.rb index 6484ef0ef8..707149a5bb 100644 --- a/spec/ruby/library/win32ole/win32ole_type/shared/name.rb +++ b/spec/ruby/library/win32ole/win32ole_type/shared/name.rb @@ -3,11 +3,11 @@ platform_is :windows do describe :win32ole_type_name, shared: true do before :each do - @ole_type = WIN32OLE_TYPE.new("Microsoft Shell Controls And Automation", "ShellSpecialFolderConstants") + @ole_type = WIN32OLE::Type.new("Microsoft Shell Controls And Automation", "ShellSpecialFolderConstants") end it "raises ArgumentError if argument is given" do - lambda { @ole_type.send(@method, 1) }.should raise_error ArgumentError + -> { @ole_type.send(@method, 1) }.should.raise ArgumentError end it "returns a String" do diff --git a/spec/ruby/library/win32ole/win32ole_type/src_type_spec.rb b/spec/ruby/library/win32ole/win32ole_type/src_type_spec.rb index 71e304d80a..9f0893b750 100644 --- a/spec/ruby/library/win32ole/win32ole_type/src_type_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_type/src_type_spec.rb @@ -1,9 +1,10 @@ +require_relative "../../../spec_helper" platform_is :windows do require 'win32ole' - describe "WIN32OLE_TYPE#src_type for Shell Controls" do + describe "WIN32OLE::Type#src_type for Shell Controls" do before :each do - @ole_type = WIN32OLE_TYPE.new("Microsoft Shell Controls And Automation", "Shell") + @ole_type = WIN32OLE::Type.new("Microsoft Shell Controls And Automation", "Shell") end after :each do @@ -11,7 +12,7 @@ platform_is :windows do end it "returns nil" do - @ole_type.src_type.should be_nil + @ole_type.src_type.should == nil end end diff --git a/spec/ruby/library/win32ole/win32ole_type/to_s_spec.rb b/spec/ruby/library/win32ole/win32ole_type/to_s_spec.rb index 5a50bd11de..03a0344fdb 100644 --- a/spec/ruby/library/win32ole/win32ole_type/to_s_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_type/to_s_spec.rb @@ -1,9 +1,10 @@ -require File.expand_path('../shared/name', __FILE__) +require_relative "../../../spec_helper" +require_relative 'shared/name' platform_is :windows do require 'win32ole' - describe "WIN32OLE_TYPE#to_s" do + describe "WIN32OLE::Type#to_s" do it_behaves_like :win32ole_type_name, :to_s end diff --git a/spec/ruby/library/win32ole/win32ole_type/typekind_spec.rb b/spec/ruby/library/win32ole/win32ole_type/typekind_spec.rb index 35f3562721..1051627025 100644 --- a/spec/ruby/library/win32ole/win32ole_type/typekind_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_type/typekind_spec.rb @@ -1,9 +1,10 @@ +require_relative "../../../spec_helper" platform_is :windows do require 'win32ole' - describe "WIN32OLE_TYPE#typekind for Shell Controls" do + describe "WIN32OLE::Type#typekind for Shell Controls" do before :each do - @ole_type = WIN32OLE_TYPE.new("Microsoft Shell Controls And Automation", "Shell") + @ole_type = WIN32OLE::Type.new("Microsoft Shell Controls And Automation", "Shell") end after :each do @@ -11,7 +12,7 @@ platform_is :windows do end it "returns an Integer" do - @ole_type.typekind.should be_kind_of Integer + @ole_type.typekind.should.is_a? Integer end end diff --git a/spec/ruby/library/win32ole/win32ole_type/typelibs_spec.rb b/spec/ruby/library/win32ole/win32ole_type/typelibs_spec.rb index 3a28c0496c..36400d75f2 100644 --- a/spec/ruby/library/win32ole/win32ole_type/typelibs_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_type/typelibs_spec.rb @@ -1,9 +1,10 @@ +require_relative "../../../spec_helper" platform_is :windows do require 'win32ole' - describe "WIN32OLE_TYPE.typelibs for Shell Controls" do + describe "WIN32OLE::Type.typelibs for Shell Controls" do before :each do - @ole_type = WIN32OLE_TYPE.new("Microsoft Shell Controls And Automation", "Shell") + @ole_type = WIN32OLE::Type.new("Microsoft Shell Controls And Automation", "Shell") end after :each do @@ -11,11 +12,11 @@ platform_is :windows do end it "raises ArgumentError if any argument is give" do - lambda { WIN32OLE_TYPE.typelibs(1) }.should raise_error ArgumentError + -> { WIN32OLE::Type.typelibs(1) }.should.raise ArgumentError end it "returns array of type libraries" do - WIN32OLE_TYPE.typelibs().include?("Microsoft Shell Controls And Automation").should be_true + WIN32OLE::Type.typelibs().include?("Microsoft Shell Controls And Automation").should == true end end diff --git a/spec/ruby/library/win32ole/win32ole_type/variables_spec.rb b/spec/ruby/library/win32ole/win32ole_type/variables_spec.rb index fbf3dd0341..b1a407523c 100644 --- a/spec/ruby/library/win32ole/win32ole_type/variables_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_type/variables_spec.rb @@ -1,9 +1,10 @@ +require_relative "../../../spec_helper" platform_is :windows do require 'win32ole' - describe "WIN32OLE_TYPE#variables for Shell Controls" do + describe "WIN32OLE::Type#variables for Shell Controls" do before :each do - @ole_type = WIN32OLE_TYPE.new("Microsoft Shell Controls And Automation", "Shell") + @ole_type = WIN32OLE::Type.new("Microsoft Shell Controls And Automation", "Shell") end after :each do diff --git a/spec/ruby/library/win32ole/win32ole_type/visible_spec.rb b/spec/ruby/library/win32ole/win32ole_type/visible_spec.rb index 403b2b843b..bca9159d53 100644 --- a/spec/ruby/library/win32ole/win32ole_type/visible_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_type/visible_spec.rb @@ -1,9 +1,10 @@ +require_relative "../../../spec_helper" platform_is :windows do require 'win32ole' - describe "WIN32OLE_TYPE#visible? for Shell Controls" do + describe "WIN32OLE::Type#visible? for Shell Controls" do before :each do - @ole_type = WIN32OLE_TYPE.new("Microsoft Shell Controls And Automation", "Shell") + @ole_type = WIN32OLE::Type.new("Microsoft Shell Controls And Automation", "Shell") end after :each do @@ -11,7 +12,7 @@ platform_is :windows do end it "returns true" do - @ole_type.visible?.should be_true + @ole_type.visible?.should == true end end diff --git a/spec/ruby/library/win32ole/win32ole_variable/name_spec.rb b/spec/ruby/library/win32ole/win32ole_variable/name_spec.rb index 724fd5c70a..dd9bfa594f 100644 --- a/spec/ruby/library/win32ole/win32ole_variable/name_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_variable/name_spec.rb @@ -1,4 +1,5 @@ -require File.expand_path('../shared/name', __FILE__) +require_relative "../../../spec_helper" +require_relative 'shared/name' platform_is :windows do require 'win32ole' diff --git a/spec/ruby/library/win32ole/win32ole_variable/ole_type_detail_spec.rb b/spec/ruby/library/win32ole/win32ole_variable/ole_type_detail_spec.rb index dab4edabaa..a9232d2b28 100644 --- a/spec/ruby/library/win32ole/win32ole_variable/ole_type_detail_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_variable/ole_type_detail_spec.rb @@ -1,3 +1,4 @@ +require_relative "../../../spec_helper" platform_is :windows do require 'win32ole' @@ -5,13 +6,13 @@ platform_is :windows do # not sure how WIN32OLE_VARIABLE objects are supposed to be generated # WIN32OLE_VARIABLE.new even seg faults in some cases before :each do - ole_type = WIN32OLE_TYPE.new("Microsoft Shell Controls And Automation", "ShellSpecialFolderConstants") + ole_type = WIN32OLE::Type.new("Microsoft Shell Controls And Automation", "ShellSpecialFolderConstants") @var = ole_type.variables[0] end it "returns a nonempty Array" do - @var.ole_type_detail.should be_kind_of Array - @var.ole_type_detail.should_not be_empty + @var.ole_type_detail.should.is_a? Array + @var.ole_type_detail.should_not.empty? end end diff --git a/spec/ruby/library/win32ole/win32ole_variable/ole_type_spec.rb b/spec/ruby/library/win32ole/win32ole_variable/ole_type_spec.rb index d08acc9bde..f28cbfd37a 100644 --- a/spec/ruby/library/win32ole/win32ole_variable/ole_type_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_variable/ole_type_spec.rb @@ -1,3 +1,4 @@ +require_relative "../../../spec_helper" platform_is :windows do require 'win32ole' @@ -5,12 +6,12 @@ platform_is :windows do # not sure how WIN32OLE_VARIABLE objects are supposed to be generated # WIN32OLE_VARIABLE.new even seg faults in some cases before :each do - ole_type = WIN32OLE_TYPE.new("Microsoft Shell Controls And Automation", "ShellSpecialFolderConstants") + ole_type = WIN32OLE::Type.new("Microsoft Shell Controls And Automation", "ShellSpecialFolderConstants") @var = ole_type.variables[0] end it "returns a String" do - @var.ole_type.should be_kind_of String + @var.ole_type.should.is_a? String end end diff --git a/spec/ruby/library/win32ole/win32ole_variable/shared/name.rb b/spec/ruby/library/win32ole/win32ole_variable/shared/name.rb index 033e830fac..d079066616 100644 --- a/spec/ruby/library/win32ole/win32ole_variable/shared/name.rb +++ b/spec/ruby/library/win32ole/win32ole_variable/shared/name.rb @@ -5,12 +5,12 @@ platform_is :windows do # not sure how WIN32OLE_VARIABLE objects are supposed to be generated # WIN32OLE_VARIABLE.new even seg faults in some cases before :each do - ole_type = WIN32OLE_TYPE.new("Microsoft Shell Controls And Automation", "ShellSpecialFolderConstants") + ole_type = WIN32OLE::Type.new("Microsoft Shell Controls And Automation", "ShellSpecialFolderConstants") @var = ole_type.variables[0] end it "returns a String" do - @var.send(@method).should be_kind_of String + @var.send(@method).should.is_a? String end end diff --git a/spec/ruby/library/win32ole/win32ole_variable/to_s_spec.rb b/spec/ruby/library/win32ole/win32ole_variable/to_s_spec.rb index 9853f91801..d4cab8e924 100644 --- a/spec/ruby/library/win32ole/win32ole_variable/to_s_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_variable/to_s_spec.rb @@ -1,4 +1,5 @@ -require File.expand_path('../shared/name', __FILE__) +require_relative "../../../spec_helper" +require_relative 'shared/name' platform_is :windows do require 'win32ole' diff --git a/spec/ruby/library/win32ole/win32ole_variable/value_spec.rb b/spec/ruby/library/win32ole/win32ole_variable/value_spec.rb index c15f64c2c5..33066e40ef 100644 --- a/spec/ruby/library/win32ole/win32ole_variable/value_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_variable/value_spec.rb @@ -1,3 +1,4 @@ +require_relative "../../../spec_helper" platform_is :windows do require 'win32ole' @@ -5,13 +6,13 @@ platform_is :windows do # not sure how WIN32OLE_VARIABLE objects are supposed to be generated # WIN32OLE_VARIABLE.new even seg faults in some cases before :each do - ole_type = WIN32OLE_TYPE.new("Microsoft Shell Controls And Automation", "ShellSpecialFolderConstants") + ole_type = WIN32OLE::Type.new("Microsoft Shell Controls And Automation", "ShellSpecialFolderConstants") @var = ole_type.variables[0] end - it "returns a Integer" do + it "returns an Integer" do # according to doc, this could return nil - @var.value.should be_kind_of Integer + @var.value.should.is_a? Integer end end diff --git a/spec/ruby/library/win32ole/win32ole_variable/variable_kind_spec.rb b/spec/ruby/library/win32ole/win32ole_variable/variable_kind_spec.rb index 4cca7f8874..2cf1d7f1f2 100644 --- a/spec/ruby/library/win32ole/win32ole_variable/variable_kind_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_variable/variable_kind_spec.rb @@ -1,3 +1,4 @@ +require_relative "../../../spec_helper" platform_is :windows do require 'win32ole' @@ -5,12 +6,12 @@ platform_is :windows do # not sure how WIN32OLE_VARIABLE objects are supposed to be generated # WIN32OLE_VARIABLE.new even seg faults in some cases before :each do - ole_type = WIN32OLE_TYPE.new("Microsoft Shell Controls And Automation", "ShellSpecialFolderConstants") + ole_type = WIN32OLE::Type.new("Microsoft Shell Controls And Automation", "ShellSpecialFolderConstants") @var = ole_type.variables[0] end it "returns a String" do - @var.variable_kind.should be_kind_of String + @var.variable_kind.should.is_a? String @var.variable_kind.should == 'CONSTANT' end diff --git a/spec/ruby/library/win32ole/win32ole_variable/varkind_spec.rb b/spec/ruby/library/win32ole/win32ole_variable/varkind_spec.rb index 56cd1c337a..04ccb8d46f 100644 --- a/spec/ruby/library/win32ole/win32ole_variable/varkind_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_variable/varkind_spec.rb @@ -1,3 +1,4 @@ +require_relative "../../../spec_helper" platform_is :windows do require 'win32ole' @@ -6,12 +7,12 @@ platform_is :windows do # not sure how WIN32OLE_VARIABLE objects are supposed to be generated # WIN32OLE_VARIABLE.new even seg faults in some cases before :each do - ole_type = WIN32OLE_TYPE.new("Microsoft Shell Controls And Automation", "ShellSpecialFolderConstants") + ole_type = WIN32OLE::Type.new("Microsoft Shell Controls And Automation", "ShellSpecialFolderConstants") @var = ole_type.variables[0] end it "returns an Integer" do - @var.varkind.should be_kind_of Integer + @var.varkind.should.is_a? Integer end end diff --git a/spec/ruby/library/win32ole/win32ole_variable/visible_spec.rb b/spec/ruby/library/win32ole/win32ole_variable/visible_spec.rb index 7f7a557b57..939468122c 100644 --- a/spec/ruby/library/win32ole/win32ole_variable/visible_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_variable/visible_spec.rb @@ -1,3 +1,4 @@ +require_relative "../../../spec_helper" platform_is :windows do require 'win32ole' @@ -5,12 +6,12 @@ platform_is :windows do # not sure how WIN32OLE_VARIABLE objects are supposed to be generated # WIN32OLE_VARIABLE.new even seg faults in some cases before :each do - ole_type = WIN32OLE_TYPE.new("Microsoft Shell Controls And Automation", "ShellSpecialFolderConstants") + ole_type = WIN32OLE::Type.new("Microsoft Shell Controls And Automation", "ShellSpecialFolderConstants") @var = ole_type.variables[0] end it "returns a String" do - @var.visible?.should be_true + @var.visible?.should == true end end |
