Project

General

Profile

Actions

Bug #13894

closed

win32ole/test_word.rb sometimes not quit Word

Added by h.shirosaki (Hiroshi Shirosaki) about 5 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Normal
Target version:
-
ruby -v:
ruby 2.5.0dev (2017-09-11 trunk 59829) [x64-mingw32]
[ruby-core:82770]

Description

When I run test-all, Word does not quit sometimes and Word opens confirm dialog to save files.
I have to close Word manually.

I think that w.quit(Word::WdDoNotSaveChanges) may be better to quit word.

diff --git a/test/win32ole/test_word.rb b/test/win32ole/test_word.rb
index 03b0bcbdde..b1cdb273cc 100644
--- a/test/win32ole/test_word.rb
+++ b/test/win32ole/test_word.rb
@@ -8,17 +8,22 @@
 end
 require "test/unit"
 
+if defined?(WIN32OLE)
+  module Word; end
+end
+
 def word_installed?
   installed = false
   w = nil
   if defined?(WIN32OLE)
     begin
       w = WIN32OLE.new('Word.Application')
+      WIN32OLE.const_load(w, Word)
       installed = true
     rescue
     ensure
       if w
-        w.quit
+        w.quit(Word::WdDoNotSaveChanges)
         w = nil
       end
     end
@@ -59,7 +64,7 @@ def test_s_connect
 
       def teardown
         if @obj
-          @obj.quit
+          @obj.quit(Word::WdDoNotSaveChanges)
           @obj = nil
         end
       end

Related issues 1 (0 open1 closed)

Related to Ruby master - Bug #14085: many redefinition warnings on test/win32ole/test_word.rbClosedsuke (Masaki Suketa)Actions
Actions

Also available in: Atom PDF