Sha256: 53b97b266f254172b2aec9b9c7b897195d7d90ac5d203e521b2fe9be1dfed8c4
Contents?: true
Size: 1.98 KB
Versions: 5
Compression:
Stored size: 1.98 KB
Contents
#!/usr/bin/env rspec # frozen_string_literal: true require_relative "spec_helper" require "dbus" describe DBus::Node do describe "#inspect" do # the behavior needs improvement it "shows the node, poorly" do parent = described_class.new("parent") parent.object = DBus::Object.new("/parent") 3.times do |i| child_name = "child#{i}" child = described_class.new(child_name) parent[child_name] = child end expect(parent.inspect).to match(/<DBus::Node [0-9a-f]+ {child0 => {},child1 => {},child2 => {}}>/) end end describe "#descendant_objects" do let(:manager_path) { "/org/example/FooManager" } let(:child_paths) do [ # note that "/org/example/FooManager/good" # is a path under a managed object but there is no object there "/org/example/FooManager/good/1", "/org/example/FooManager/good/2", "/org/example/FooManager/good/3", "/org/example/FooManager/bad/1", "/org/example/FooManager/bad/2" ] end let(:non_child_paths) do [ "/org/example/BarManager/good/1", "/org/example/BarManager/good/2" ] end context "on the bus" do let(:bus) { DBus::ASessionBus.new } let(:service) do # if we used org.ruby.service it would be a name collision # ... which would not break the test for lucky reasons bus.request_service("org.ruby.service.scratch") end before do service.export(DBus::Object.new(manager_path)) non_child_paths.each do |p| service.export(DBus::Object.new(p)) end end it "returns just the descendants of the specified objects" do child_exported_objects = child_paths.map { |p| DBus::Object.new(p) } child_exported_objects.each { |obj| service.export(obj) } node = service.get_node(manager_path, create: false) expect(node.descendant_objects).to eq child_exported_objects end end end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
ruby-dbus-0.22.1 | spec/node_spec.rb |
ruby-dbus-0.22.0 | spec/node_spec.rb |
ruby-dbus-0.21.0 | spec/node_spec.rb |
ruby-dbus-0.20.0 | spec/node_spec.rb |
ruby-dbus-0.19.0 | spec/node_spec.rb |