diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-08-30 06:46:16 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-08-30 06:46:16 +0000 |
commit | e7d578bf587050c08aaf9f9ac1b71ce69be044d7 (patch) | |
tree | b325809ed212d03c4a8f6d2dd8eac5860d86db89 | |
parent | 9507c92d37b912baf4847f730a5f261764199cba (diff) | |
download | ruby-e7d578bf587050c08aaf9f9ac1b71ce69be044d7.tar.gz |
test_win32ole_event.rb: skip 80041008
* test/win32ole/test_win32ole_event.rb (exec_notification_query_async):
skip error with OLE error code:80041008, which seems to occur when
logging in as a non admistrator user.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51725 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | test/win32ole/test_win32ole_event.rb | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/test/win32ole/test_win32ole_event.rb b/test/win32ole/test_win32ole_event.rb index 86004cdad7..a1ad9b1025 100644 --- a/test/win32ole/test_win32ole_event.rb +++ b/test/win32ole/test_win32ole_event.rb @@ -91,7 +91,7 @@ if defined?(WIN32OLE_EVENT) end def test_s_new_loop - @wmi.ExecNotificationQueryAsync(@sws, @sql) + exec_notification_query_async ev = WIN32OLE_EVENT.new(@sws) ev.on_event {|*args| default_handler(*args)} message_loop @@ -104,7 +104,7 @@ if defined?(WIN32OLE_EVENT) end def test_on_event - @wmi.ExecNotificationQueryAsync(@sws, @sql) + exec_notification_query_async ev = WIN32OLE_EVENT.new(@sws, 'ISWbemSinkEvents') ev.on_event {|*args| default_handler(*args)} message_loop @@ -112,7 +112,7 @@ if defined?(WIN32OLE_EVENT) end def test_on_event_symbol - @wmi.ExecNotificationQueryAsync(@sws, @sql) + exec_notification_query_async ev = WIN32OLE_EVENT.new(@sws) ev.on_event(:OnObjectReady) {|*args| handler1 @@ -121,6 +121,14 @@ if defined?(WIN32OLE_EVENT) assert_equal("handler1", @event1) end + private + def exec_notification_query_async + @wmi.ExecNotificationQueryAsync(@sws, @sql) + rescue => e + # No administrator privilege? + skip if /OLE error code:80041008 in SWbemServicesEx/ =~ e.message + raise + end end end |