Sha256: d5fec1ea3480e8999d5977278fd4fb8c3d56b146db0ef18323d6f17ef8ea332b

Contents?: true

Size: 1.01 KB

Versions: 9

Compression:

Stored size: 1.01 KB

Contents

#!/usr/bin/env rspec
# frozen_string_literal: true

require_relative "spec_helper"
require "dbus"

describe DBus::ObjectManager do
  describe "GetManagedObjects" do
    let(:bus) { DBus::ASessionBus.new }
    let(:service) { bus["org.ruby.service"] }
    let(:obj) { service["/org/ruby/MyInstance"] }
    let(:parent_iface) { obj["org.ruby.TestParent"] }
    let(:om_iface) { obj["org.freedesktop.DBus.ObjectManager"] }

    it "returns the interfaces and properties of currently managed objects" do
      c1_opath = parent_iface.New("child1")
      c2_opath = parent_iface.New("child2")

      parent_iface.Delete(c1_opath)
      expected_gmo = {
        "/org/ruby/MyInstance/child2" => {
          "org.freedesktop.DBus.Introspectable" => {},
          "org.freedesktop.DBus.Properties" => {},
          "org.ruby.TestChild" => { "Name" => "Child2" }
        }
      }
      expect(om_iface.GetManagedObjects).to eq(expected_gmo)

      parent_iface.Delete(c2_opath)
      expect(om_iface.GetManagedObjects).to eq({})
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
ruby-dbus-0.24.0 spec/object_manager_spec.rb
ruby-dbus-0.23.1 spec/object_manager_spec.rb
ruby-dbus-0.23.0.beta2 spec/object_manager_spec.rb
ruby-dbus-0.23.0.beta1 spec/object_manager_spec.rb
ruby-dbus-0.22.1 spec/object_manager_spec.rb
ruby-dbus-0.22.0 spec/object_manager_spec.rb
ruby-dbus-0.21.0 spec/object_manager_spec.rb
ruby-dbus-0.20.0 spec/object_manager_spec.rb
ruby-dbus-0.19.0 spec/object_manager_spec.rb