2017-05-07 12:04:49 +00:00
|
|
|
platform_is :windows do
|
2018-10-28 05:40:41 +00:00
|
|
|
require_relative '../fixtures/classes'
|
2017-05-07 12:04:49 +00:00
|
|
|
|
2018-10-28 05:40:41 +00:00
|
|
|
guard -> { WIN32OLESpecs::MSXML_AVAILABLE } do
|
|
|
|
describe "WIN32OLE_EVENT.new" do
|
|
|
|
before :all do
|
|
|
|
@xml_dom = WIN32OLESpecs.new_ole('MSXML.DOMDocument')
|
|
|
|
end
|
2017-05-07 12:04:49 +00:00
|
|
|
|
2018-10-28 05:40:41 +00:00
|
|
|
after :all do
|
|
|
|
@xml_dom = nil
|
|
|
|
end
|
2017-05-07 12:04:49 +00:00
|
|
|
|
2018-10-28 05:40:41 +00:00
|
|
|
it "raises TypeError given invalid argument" do
|
2019-07-27 12:40:09 +02:00
|
|
|
-> { WIN32OLE_EVENT.new "A" }.should raise_error TypeError
|
2018-10-28 05:40:41 +00:00
|
|
|
end
|
2017-05-07 12:04:49 +00:00
|
|
|
|
2018-10-28 05:40:41 +00:00
|
|
|
it "raises RuntimeError if event does not exist" do
|
2019-07-27 12:40:09 +02:00
|
|
|
-> { WIN32OLE_EVENT.new(@xml_dom, 'A') }.should raise_error RuntimeError
|
2018-10-28 05:40:41 +00:00
|
|
|
end
|
2017-05-07 12:04:49 +00:00
|
|
|
|
2018-10-28 05:40:41 +00:00
|
|
|
it "raises RuntimeError if OLE object has no events" do
|
|
|
|
dict = WIN32OLESpecs.new_ole('Scripting.Dictionary')
|
2019-07-27 12:40:09 +02:00
|
|
|
-> { WIN32OLE_EVENT.new(dict) }.should raise_error RuntimeError
|
2018-10-28 05:40:41 +00:00
|
|
|
end
|
2017-05-07 12:04:49 +00:00
|
|
|
|
2018-10-28 05:40:41 +00:00
|
|
|
it "creates WIN32OLE_EVENT object" do
|
|
|
|
ev = WIN32OLE_EVENT.new(@xml_dom)
|
|
|
|
ev.should be_kind_of WIN32OLE_EVENT
|
|
|
|
end
|
2017-05-07 12:04:49 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|