test/server_robustness_test.rb in ruby-dbus-0.5.0 vs test/server_robustness_test.rb in ruby-dbus-0.6.0
- old
+ new
@@ -36,6 +36,37 @@
obj.will_raise
assert false, "should have raised"
rescue DBus::Error => e
assert_no_match(/timeout/, e.to_s)
end
+
+ def test_a_method_that_raises_name_error
+ obj = @svc.object "/org/ruby/MyInstance"
+ obj.introspect
+ obj.default_iface = "org.ruby.SampleInterface"
+ obj.will_raise_name_error
+ assert false, "should have raised"
+ rescue DBus::Error => e
+ assert_no_match(/timeout/, e.to_s)
+ end
+
+ # https://trac.luon.net/ruby-dbus/ticket/31#comment:3
+ def test_no_such_method_without_introspection
+ obj = @svc.object "/org/ruby/MyInstance"
+ ifc = DBus::ProxyObjectInterface.new(obj, "org.ruby.SampleInterface")
+ ifc.define_method("not_the_answer", "out n:i")
+ ifc.not_the_answer
+ assert false, "should have raised"
+ rescue DBus::Error => e
+ assert_no_match(/timeout/, e)
+ end
+
+ def test_no_such_interface_without_introspection
+ obj = @svc.object "/org/ruby/MyInstance"
+ ifc = DBus::ProxyObjectInterface.new(obj, "org.ruby.NoSuchInterface")
+ ifc.define_method("the_answer", "out n:i")
+ ifc.the_answer
+ assert false, "should have raised"
+ rescue DBus::Error => e
+ assert_no_match(/timeout/, e)
+ end
end