[前][次][番号順一覧][スレッド一覧]

ruby-changes:53195

From: suke <ko1@a...>
Date: Sun, 28 Oct 2018 14:08:43 +0900 (JST)
Subject: [ruby-changes:53195] suke:r65410 (trunk): use Scripting.Dictionary instead of InternetExplorer.Application.

suke	2018-10-28 14:08:37 +0900 (Sun, 28 Oct 2018)

  New Revision: 65410

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=65410

  Log:
    use Scripting.Dictionary instead of InternetExplorer.Application.
    
    * spec/ruby/library/win32ole/win32ole/shared/setproperty.rb: use
      Scripting.Dictionary. InternetExplorer.Application is not available on
      some environments. Thanks to MSP-Greg (Greg L).

  Modified files:
    trunk/spec/ruby/library/win32ole/win32ole/setproperty_spec.rb
    trunk/spec/ruby/library/win32ole/win32ole/shared/setproperty.rb
Index: spec/ruby/library/win32ole/win32ole/shared/setproperty.rb
===================================================================
--- spec/ruby/library/win32ole/win32ole/shared/setproperty.rb	(revision 65409)
+++ spec/ruby/library/win32ole/win32ole/shared/setproperty.rb	(revision 65410)
@@ -1,25 +1,23 @@ https://github.com/ruby/ruby/blob/trunk/spec/ruby/library/win32ole/win32ole/shared/setproperty.rb#L1
-require_relative '../../fixtures/classes'
-
 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
+      lambda { @dict.send(@method) }.should raise_error 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
Index: spec/ruby/library/win32ole/win32ole/setproperty_spec.rb
===================================================================
--- spec/ruby/library/win32ole/win32ole/setproperty_spec.rb	(revision 65409)
+++ spec/ruby/library/win32ole/win32ole/setproperty_spec.rb	(revision 65410)
@@ -1,8 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/spec/ruby/library/win32ole/win32ole/setproperty_spec.rb#L1
-require_relative '../fixtures/classes'
-require_relative 'shared/setproperty'
-
 platform_is :windows do
-  require 'win32ole'
+  require_relative '../fixtures/classes'
+  require_relative 'shared/setproperty'
 
   describe "WIN32OLE#setproperty" do
     it_behaves_like :win32ole_setproperty, :setproperty

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]