Project

General

Profile

Feature #15239 ยป spec_win32ole.patch

MSP-Greg (Greg L), 10/20/2018 07:28 PM

View differences:

spec/ruby/library/win32ole/fixtures/classes.rb
1
require 'win32ole'
2
  
1 3
module WIN32OLESpecs
4
  MSXML_AVAILABLE = !!WIN32OLE_TYPELIB.typelibs.find { |t| t.name.start_with?('Microsoft XML') }
5

  
2 6
  def self.new_ole(name)
3 7
    retried = false
4 8
    begin
spec/ruby/library/win32ole/fixtures/event.xml
1
<program>
2
  <name>Ruby</name>
3
  <version>trunk</version>
4
</program>
spec/ruby/library/win32ole/win32ole/_getproperty_spec.rb
1
require_relative '../fixtures/classes'
2

  
3 1
platform_is :windows do
4
  require 'win32ole'
2
  require_relative '../fixtures/classes'
3
  guard -> { WIN32OLESpecs::MSXML_AVAILABLE } do
5 4

  
6
  describe "WIN32OLE#_getproperty" do
7
    before :each do
8
      @ie = WIN32OLESpecs.new_ole('InternetExplorer.Application')
9
    end
5
    describe "WIN32OLE#_getproperty" do
6
      before :all do
7
        @xml_dom = WIN32OLESpecs.new_ole('MSXML.DOMDocument')
8
      end
10 9

  
11
    after :each do
12
      @ie.Quit
13
    end
10
      after :all do
11
        @xml_dom = nil
12
      end
14 13

  
15
    it "gets name" do
16
      @ie._getproperty(0, [], []).should =~ /explorer/i
14
      it "gets validateOnParse" do
15
        @xml_dom._getproperty(65, [], []).should be_true
16
      end
17 17
    end
18 18
  end
19 19
end
spec/ruby/library/win32ole/win32ole/_invoke_spec.rb
1
require_relative '../fixtures/classes'
2

  
3 1
platform_is :windows do
4
  require 'win32ole'
2
  require_relative '../fixtures/classes'
5 3

  
6 4
  describe "WIN32OLE#_invoke" do
7 5
    before :each do
spec/ruby/library/win32ole/win32ole/codepage_spec.rb
1
require_relative '../fixtures/classes'
2

  
3 1
platform_is :windows do
4
  require 'win32ole'
2
  require_relative '../fixtures/classes'
5 3

  
6 4
  describe "WIN32OLE.codepage=" do
7 5
    it "sets codepage" do
spec/ruby/library/win32ole/win32ole/connect_spec.rb
1
require_relative '../fixtures/classes'
2

  
3 1
platform_is :windows do
4
  require 'win32ole'
2
  require_relative '../fixtures/classes'
5 3

  
6 4
  describe "WIN32OLE.connect" do
7 5
    it "creates WIN32OLE object given valid argument" do
spec/ruby/library/win32ole/win32ole/const_load_spec.rb
1
require_relative '../fixtures/classes'
2

  
3 1
platform_is :windows do
4
  require 'win32ole'
2
  require_relative '../fixtures/classes'
5 3

  
6 4
  describe "WIN32OLE.const_load when passed Shell.Application OLE object" do
7 5
    before :each do
spec/ruby/library/win32ole/win32ole/constants_spec.rb
1
require_relative '../fixtures/classes'
2

  
3 1
platform_is :windows do
4
  require 'win32ole'
2
  require_relative '../fixtures/classes'
5 3

  
6 4
  describe "WIN32OLE class" do
7 5
    it "defines constant CP_ACP" do
spec/ruby/library/win32ole/win32ole/create_guid_spec.rb
1
require_relative '../fixtures/classes'
2

  
3 1
platform_is :windows do
4
  require 'win32ole'
2
  require_relative '../fixtures/classes'
5 3

  
6 4
  describe "WIN32OLE.create_guid" do
7 5
    it "generates guid with valid format" do
spec/ruby/library/win32ole/win32ole/invoke_spec.rb
1
require_relative '../fixtures/classes'
2

  
3 1
platform_is :windows do
4
  require 'win32ole'
2
  require_relative '../fixtures/classes'
3
  guard -> { WIN32OLESpecs::MSXML_AVAILABLE } do
5 4

  
6
  describe "WIN32OLE#invoke" do
7
    before :each do
8
      @ie = WIN32OLESpecs.new_ole('InternetExplorer.Application')
9
    end
5
    describe "WIN32OLE#invoke" do
6
      before :all do
7
        @xml_dom = WIN32OLESpecs.new_ole('MSXML.DOMDocument')
8
      end
10 9

  
11
    after :each do
12
      @ie.Quit
13
    end
10
      after :all do
11
        @xml_dom = nil
12
      end
14 13

  
15
    it "get name by invoking 'Name' OLE method" do
16
      @ie.invoke('Name').should =~ /explorer/i
14
      it "get name by invoking 'validateOnParse' OLE method" do
15
        @xml_dom.invoke('validateOnParse').should be_true
16
      end
17 17
    end
18 18
  end
19 19
end
spec/ruby/library/win32ole/win32ole/locale_spec.rb
1
require_relative '../fixtures/classes'
2

  
3 1
platform_is :windows do
4
  require 'win32ole'
2
  require_relative '../fixtures/classes'
5 3

  
6 4
  describe "WIN32OLE.locale" do
7 5
    it "gets locale" do
spec/ruby/library/win32ole/win32ole/new_spec.rb
1
require_relative '../fixtures/classes'
2

  
3 1
platform_is :windows do
4
  require 'win32ole'
2
  require_relative '../fixtures/classes'
5 3

  
6 4
  describe "WIN32OLESpecs.new_ole" do
7 5
    it "creates a WIN32OLE object from OLE server name" do
spec/ruby/library/win32ole/win32ole/ole_func_methods_spec.rb
1
require_relative '../fixtures/classes'
2

  
3 1
platform_is :windows do
4
  require 'win32ole'
2
  require_relative '../fixtures/classes'
3
  guard -> { WIN32OLESpecs::MSXML_AVAILABLE } do
5 4

  
6
  describe "WIN32OLE#ole_func_methods" do
7
    before :each do
8
      @ie = WIN32OLESpecs.new_ole('InternetExplorer.Application')
9
    end
5
    describe "WIN32OLE#ole_func_methods" do
6
      before :all do
7
        @xml_dom = WIN32OLESpecs.new_ole('MSXML.DOMDocument')
8
      end
10 9

  
11
    after :each do
12
      @ie.Quit if @ie
13
    end
10
      after :all do
11
        @xml_dom =nil
12
      end
14 13

  
15
    it "raises ArgumentError if argument is given" do
16
      lambda { @ie.ole_func_methods(1) }.should raise_error ArgumentError
17
    end
14
      it "raises ArgumentError if argument is given" do
15
        lambda { @xml_dom.ole_func_methods(1) }.should raise_error ArgumentError
16
      end
18 17

  
19
    it "returns an array of WIN32OLE_METHODs" do
20
      @ie.ole_func_methods.all? { |m| m.kind_of? WIN32OLE_METHOD }.should be_true
21
    end
18
      it "returns an array of WIN32OLE_METHODs" do
19
        @xml_dom.ole_func_methods.all? { |m| m.kind_of? WIN32OLE_METHOD }.should be_true
20
      end
22 21

  
23
    it "contains a 'AddRef' method for Internet Explorer" do
24
      @ie.ole_func_methods.map { |m| m.name }.include?('AddRef').should be_true
22
      it "contains a 'AddRef' method for Internet Explorer" do
23
        @xml_dom.ole_func_methods.map { |m| m.name }.include?('AddRef').should be_true
24
      end
25 25
    end
26 26
  end
27 27
end
spec/ruby/library/win32ole/win32ole/ole_get_methods_spec.rb
1
require_relative '../fixtures/classes'
2

  
3 1
platform_is :windows do
4
  require 'win32ole'
2
  require_relative '../fixtures/classes'
5 3

  
6 4
  describe "WIN32OLE#ole_get_methods" do
7 5

  
spec/ruby/library/win32ole/win32ole/ole_method_help_spec.rb
1
require_relative '../fixtures/classes'
2
require_relative 'shared/ole_method'
3

  
4 1
platform_is :windows do
5
  require 'win32ole'
2
  require_relative 'shared/ole_method'
6 3

  
7 4
  describe "WIN32OLE#ole_method_help" do
8 5
    it_behaves_like :win32ole_ole_method, :ole_method_help
spec/ruby/library/win32ole/win32ole/ole_method_spec.rb
1
require_relative '../fixtures/classes'
2
require_relative 'shared/ole_method'
3

  
4 1
platform_is :windows do
5
  require 'win32ole'
2
  require_relative 'shared/ole_method'
6 3

  
7 4
  describe "WIN32OLE#ole_method" do
8 5
    it_behaves_like :win32ole_ole_method, :ole_method
9

  
10 6
  end
11 7

  
12 8
end
spec/ruby/library/win32ole/win32ole/ole_methods_spec.rb
1
require_relative '../fixtures/classes'
2

  
3 1
platform_is :windows do
4
  require 'win32ole'
2
  require_relative '../fixtures/classes'
3
  guard -> { WIN32OLESpecs::MSXML_AVAILABLE } do
5 4

  
6
  describe "WIN32OLE#ole_methods" do
7
    before :each do
8
      @ie = WIN32OLESpecs.new_ole('InternetExplorer.Application')
9
    end
5
    describe "WIN32OLE#ole_methods" do
6
      before :all do
7
        @xml_dom = WIN32OLESpecs.new_ole('MSXML.DOMDocument')
8
      end
10 9

  
11
    after :each do
12
      @ie.Quit
13
    end
10
      after :all do
11
        @xml_dom = nil
12
      end
14 13

  
15
    it "raises ArgumentError if argument is given" do
16
      lambda { @ie.ole_methods(1) }.should raise_error ArgumentError
17
    end
14
      it "raises ArgumentError if argument is given" do
15
        lambda { @xml_dom.ole_methods(1) }.should raise_error ArgumentError
16
      end
18 17

  
19
    it "returns an array of WIN32OLE_METHODs" do
20
      @ie.ole_methods.all? { |m| m.kind_of? WIN32OLE_METHOD }.should be_true
21
    end
18
      it "returns an array of WIN32OLE_METHODs" do
19
        @xml_dom.ole_methods.all? { |m| m.kind_of? WIN32OLE_METHOD }.should be_true
20
      end
22 21

  
23
    it "contains a 'AddRef' method for Internet Explorer" do
24
      @ie.ole_methods.map { |m| m.name }.include?('AddRef').should be_true
22
      it "contains a 'validateOnParse' method for Internet Explorer" do
23
        @xml_dom.ole_methods.map { |m| m.name }.include?('validateOnParse').should be_true
24
      end
25 25
    end
26 26
  end
27 27
end
spec/ruby/library/win32ole/win32ole/ole_obj_help_spec.rb
1
require_relative '../fixtures/classes'
2

  
3 1
platform_is :windows do
4
  require 'win32ole'
2
  require_relative '../fixtures/classes'
3
  guard -> { WIN32OLESpecs::MSXML_AVAILABLE } do
5 4

  
6
  describe "WIN32OLE#ole_obj_help" do
7
    before :each do
8
      @ie = WIN32OLESpecs.new_ole('InternetExplorer.Application')
9
    end
5
    describe "WIN32OLE#ole_obj_help" do
6
      before :all do
7
        @xml_dom = WIN32OLESpecs.new_ole('MSXML.DOMDocument')
8
      end
10 9

  
11
    after :each do
12
      @ie.Quit
13
    end
10
      after :all do
11
        @xml_dom = nil
12
      end
14 13

  
15
    it "raises ArgumentError if argument is given" do
16
      lambda { @ie.ole_obj_help(1) }.should raise_error ArgumentError
17
    end
14
      it "raises ArgumentError if argument is given" do
15
        lambda { @xml_dom.ole_obj_help(1) }.should raise_error ArgumentError
16
      end
18 17

  
19
    it "returns an instance of WIN32OLE_TYPE" do
20
      @ie.ole_obj_help.kind_of?(WIN32OLE_TYPE).should be_true
18
      it "returns an instance of WIN32OLE_TYPE" do
19
        @xml_dom.ole_obj_help.kind_of?(WIN32OLE_TYPE).should be_true
20
      end
21 21
    end
22 22
  end
23 23
end
spec/ruby/library/win32ole/win32ole/ole_put_methods_spec.rb
1
require_relative '../fixtures/classes'
2

  
3 1
platform_is :windows do
4
  require 'win32ole'
2
  require_relative '../fixtures/classes'
3
  guard -> { WIN32OLESpecs::MSXML_AVAILABLE } do
5 4

  
6
  describe "WIN32OLE#ole_put_methods" do
7
    before :each do
8
      @ie = WIN32OLESpecs.new_ole('InternetExplorer.Application')
9
    end
5
    describe "WIN32OLE#ole_put_methods" do
6
      before :all do
7
        @xml_dom = WIN32OLESpecs.new_ole('MSXML.DOMDocument')
8
      end
10 9

  
11
    after :each do
12
      @ie.Quit
13
    end
10
      after :all do
11
        @xml_dom = nil
12
      end
14 13

  
15
    it "raises ArgumentError if argument is given" do
16
      lambda { @ie.ole_put_methods(1) }.should raise_error ArgumentError
17
    end
14
      it "raises ArgumentError if argument is given" do
15
        lambda { @xml_dom.ole_put_methods(1) }.should raise_error ArgumentError
16
      end
18 17

  
19
    it "returns an array of WIN32OLE_METHODs" do
20
      @ie.ole_put_methods.all? { |m| m.kind_of? WIN32OLE_METHOD }.should be_true
21
    end
18
      it "returns an array of WIN32OLE_METHODs" do
19
        @xml_dom.ole_put_methods.all? { |m| m.kind_of? WIN32OLE_METHOD }.should be_true
20
      end
22 21

  
23
    it "contains a 'Height' method for Internet Explorer" do
24
      @ie.ole_put_methods.map { |m| m.name }.include?('Height').should be_true
22
      it "contains a 'preserveWhiteSpace' method" do
23
        @xml_dom.ole_put_methods.map { |m| m.name }.include?('preserveWhiteSpace').should be_true
24
      end
25 25
    end
26 26
  end
27 27
end
spec/ruby/library/win32ole/win32ole/setproperty_spec.rb
1
require_relative '../fixtures/classes'
2
require_relative 'shared/setproperty'
3

  
4 1
platform_is :windows do
5
  require 'win32ole'
2
  require_relative 'shared/setproperty'
6 3

  
7 4
  describe "WIN32OLE#setproperty" do
8 5
    it_behaves_like :win32ole_setproperty, :setproperty
spec/ruby/library/win32ole/win32ole/shared/ole_method.rb
1
require_relative '../../fixtures/classes'
2

  
3 1
platform_is :windows do
4
  require 'win32ole'
2
  require_relative '../../fixtures/classes'
3
  guard -> { WIN32OLESpecs::MSXML_AVAILABLE } do
5 4

  
6
  describe :win32ole_ole_method, shared: true do
7
    before :each do
8
      # This part is unstable, so retrying 3 times.
9
      tries = 0
10
      begin
11
        @ie = WIN32OLESpecs.new_ole('InternetExplorer.Application')
12
      rescue WIN32OLERuntimeError => e
13
        # WIN32OLERuntimeError: failed to create WIN32OLE object from `InternetExplorer.Application'
14
        #     HRESULT error code:0x800704a6
15
        #       A system shutdown has already been scheduled.
16
        if tries < 3
17
          tries += 1
18
          $stderr.puts "win32ole_ole_method retry (#{tries}): #{e.class}: #{e.message}"
19
          retry
20
        end
5
    describe :win32ole_ole_method, shared: true do
6
      before :all do
7
        @xml_dom = WIN32OLESpecs.new_ole('MSXML.DOMDocument')
21 8
      end
22
    end
23 9

  
24
    after :each do
25
      @ie.Quit
26
    end
10
      after :all do
11
        @xml_dom = nil
12
      end
27 13

  
28
    it "raises ArgumentError if no argument is given" do
29
      lambda { @ie.send(@method) }.should raise_error ArgumentError
30
    end
14
      it "raises ArgumentError if no argument is given" do
15
        lambda { @xml_dom.send(@method) }.should raise_error ArgumentError
16
      end
31 17

  
32
    it "returns the WIN32OLE_METHOD 'Quit' if given 'Quit'" do
33
      result = @ie.send(@method, "Quit")
34
      result.kind_of?(WIN32OLE_METHOD).should be_true
35
      result.name.should == 'Quit'
18
      it "returns the WIN32OLE_METHOD 'abort' if given 'abort'" do
19
        result = @xml_dom.send(@method, "abort")
20
        result.kind_of?(WIN32OLE_METHOD).should be_true
21
        result.name.should == 'abort'
22
      end
36 23
    end
37 24
  end
38 25
end
spec/ruby/library/win32ole/win32ole/shared/setproperty.rb
1
require_relative '../../fixtures/classes'
2

  
3 1
platform_is :windows do
4
  require 'win32ole'
2
  require_relative '../../fixtures/classes'
3
  guard -> { WIN32OLESpecs::MSXML_AVAILABLE } do
5 4

  
6
  describe :win32ole_setproperty, shared: true do
7
    before :each do
8
      @ie = WIN32OLESpecs.new_ole('InternetExplorer.Application')
9
    end
5
    describe :win32ole_setproperty, shared: true do
6
      before :all do
7
        @xml_dom = WIN32OLESpecs.new_ole('MSXML.DOMDocument')
8
      end
10 9

  
11
    after :each do
12
      @ie.Quit
13
    end
10
      after :all do
11
        @xml_dom = nil
12
      end
14 13

  
15
    it "raises ArgumentError if no argument is given" do
16
      lambda { @ie.send(@method) }.should raise_error ArgumentError
17
    end
14
      it "raises ArgumentError if no argument is given" do
15
        lambda { @xml_dom.send(@method) }.should raise_error ArgumentError
16
      end
18 17

  
19
    it "sets height to 500 and returns nil" do
20
      height = 500
21
      result = @ie.send(@method, 'Height', height)
22
      result.should == nil
18
      it "sets async true and returns nil" do
19
        result = @xml_dom.send(@method, 'async', true)
20
        result.should == nil
21
      end
23 22
    end
24 23
  end
25 24
end
spec/ruby/library/win32ole/win32ole_event/new_spec.rb
1
require_relative '../fixtures/classes'
2

  
3 1
platform_is :windows do
4
  require 'win32ole'
2
  require_relative '../fixtures/classes'
3
  guard -> { WIN32OLESpecs::MSXML_AVAILABLE } do
4
  
5
    describe "WIN32OLE_EVENT.new" do
6
      before :all do
7
        @xml_dom = WIN32OLESpecs.new_ole('MSXML.DOMDocument')
8
      end
5 9

  
6
  describe "WIN32OLE_EVENT.new" do
7
    before :each do
8
      @ie = WIN32OLESpecs.new_ole('InternetExplorer.Application')
9
    end
10
      after :all do
11
        @xml_dom = nil
12
      end
10 13

  
11
    after :each do
12
      @ie.Quit if @ie
13
    end
14
      it "raises TypeError given invalid argument" do
15
        lambda { WIN32OLE_EVENT.new "A" }.should raise_error TypeError
16
      end
14 17

  
15
    it "raises TypeError given invalid argument" do
16
      lambda { WIN32OLE_EVENT.new "A" }.should raise_error TypeError
17
    end
18
      it "raises RuntimeError if event does not exist" do
19
        lambda { WIN32OLE_EVENT.new(@xml_dom, 'A') }.should raise_error RuntimeError
20
      end
18 21

  
19
    it "raises RuntimeError if event does not exist" do
20
      lambda { WIN32OLE_EVENT.new(@ie, 'A') }.should raise_error RuntimeError
21
    end
22

  
23
    it "raises RuntimeError if OLE object has no events" do
24
      dict = WIN32OLESpecs.new_ole('Scripting.Dictionary')
25
      lambda { WIN32OLE_EVENT.new(dict) }.should raise_error RuntimeError
26
    end
22
      it "raises RuntimeError if OLE object has no events" do
23
        dict = WIN32OLESpecs.new_ole('Scripting.Dictionary')
24
        lambda { WIN32OLE_EVENT.new(dict) }.should raise_error RuntimeError
25
      end
27 26

  
28
    it "creates WIN32OLE_EVENT object" do
29
      ev = WIN32OLE_EVENT.new(@ie, 'DWebBrowserEvents')
30
      ev.should be_kind_of WIN32OLE_EVENT
27
      it "creates WIN32OLE_EVENT object" do
28
        ev = WIN32OLE_EVENT.new(@xml_dom)
29
        ev.should be_kind_of WIN32OLE_EVENT
30
      end
31 31
    end
32 32
  end
33 33
end
spec/ruby/library/win32ole/win32ole_event/on_event_spec.rb
1
require_relative '../fixtures/classes'
2

  
3 1
platform_is :windows do
4
  require 'win32ole'
5

  
6
  def default_handler(event, *args)
7
    @event += event
8
  end
9

  
10
  def alternate_handler(event, *args)
11
    @event2 = "alternate"
12
  end
13

  
14
  def handler3(event, *args)
15
    @event3 += event
16
  end
2
  require_relative '../fixtures/classes'
3
  guard -> { WIN32OLESpecs::MSXML_AVAILABLE } do
17 4

  
18

  
19
  describe "WIN32OLE_EVENT#on_event with no argument" do
20
    before :each do
21
      @ie     = WIN32OLESpecs.new_ole('InternetExplorer.Application')
22
      @ev     = WIN32OLE_EVENT.new(@ie, 'DWebBrowserEvents')
23
      @event  = ''
24
      @event2 = ''
25
      @event3 = ''
26
      @ie.StatusBar = true
5
    def handler_global(event, *args)
6
      @event_global += event
27 7
    end
28 8

  
29
    after :each do
30
      @ie.Quit
9
    def handler_specific(*args)
10
      @event_specific = "specific"
31 11
    end
32 12

  
33
    it "sets event handler properly, and the handler is invoked by event loop" do
34
      @ev.on_event { |*args| default_handler(*args) }
35
      @ie.StatusText='hello'
36
      WIN32OLE_EVENT.message_loop
37
      @event.should =~ /StatusTextChange/
13
    def handler_spec_alt(*args)
14
      @event_spec_alt = "spec_alt"
38 15
    end
39 16

  
40
    it "accepts a String argument, sets event handler properly, and the handler is invoked by event loop" do
41
      @ev.on_event("StatusTextChange") { |*args| @event = 'foo' }
42
      @ie.StatusText='hello'
43
      WIN32OLE_EVENT.message_loop
44
      @event.should =~ /foo/
45
    end
17
    describe "WIN32OLE_EVENT#on_event" do
18
    
19
      before :all do
20
        @fn_xml = File.absolute_path "../fixtures/event.xml", __dir__
21
      end
22
    
23
      before :each do
24
        @xml_dom = WIN32OLESpecs.new_ole 'MSXML.DOMDocument'
25
        @xml_dom.async = true
26
        @ev = WIN32OLE_EVENT.new @xml_dom
27
        @event_global   = ''
28
        @event_specific = ''
29
        @event_spec_alt = ''
30
      end
46 31

  
47
    it "registers multiple event handlers for the same event" do
48
      @ev.on_event("StatusTextChange") { |*args| default_handler(*args) }
49
      @ev.on_event("StatusTextChange") { |*args| alternate_handler(*args) }
50
      @ie.StatusText= 'hello'
51
      WIN32OLE_EVENT.message_loop
52
      @event2.should == 'alternate'
53
    end
32
      after :each do
33
        @xml_dom = nil
34
        @ev = nil
35
      end
36

  
37
      it "sets global event handler properly, and the handler is invoked by event loop" do
38
        @ev.on_event { |*args| handler_global(*args) }
39
        @xml_dom.loadXML "<program><name>Ruby</name><version>trunk</version></program>"
40
        WIN32OLE_EVENT.message_loop
41
        @event_global.should =~ /onreadystatechange/
42
      end
43

  
44
      it "accepts a String argument and the handler is invoked by event loop" do
45
        @ev.on_event("onreadystatechange") { |*args| @event = 'foo' }
46
        @xml_dom.loadXML "<program><name>Ruby</name><version>trunk</version></program>"
47
        WIN32OLE_EVENT.message_loop
48
        @event.should =~ /foo/
49
      end
50

  
51
      it "accepts a Symbol argument and the handler is invoked by event loop" do
52
        @ev.on_event(:onreadystatechange) { |*args| @event = 'bar' }
53
        @xml_dom.loadXML "<program><name>Ruby</name><version>trunk</version></program>"
54
        WIN32OLE_EVENT.message_loop
55
        @event.should =~ /bar/
56
      end
54 57

  
55
    it "accepts a Symbol argument, sets event handler properly, and the handler is invoked by event loop" do
56
      @ev.on_event(:StatusTextChange) { |*args| @event = 'foo' }
57
      @ie.StatusText='hello'
58
      WIN32OLE_EVENT.message_loop
59
      @event.should =~ /foo/
58
      it "accepts a specific event handler and overrides a global event handler" do
59
        @ev.on_event                       { |*args| handler_global(*args)   }
60
        @ev.on_event("onreadystatechange") { |*args| handler_specific(*args) }
61
        @ev.on_event("onreadystatechange") { |*args| handler_spec_alt(*args) }
62
        @xml_dom.load @fn_xml
63
        WIN32OLE_EVENT.message_loop
64
        @event_global.should == 'ondataavailable'
65
        @event_global.should_not =~ /onreadystatechange/
66
        @event_specific.should == ''
67
        @event_spec_alt.should == "spec_alt"
68
      end
60 69
    end
61 70
  end
62 71
end