Sha256: 332d1afc2ec7a81880ec9d0c59aad6d27611c7254dcdf10d1fe24111be53d7c8

Contents?: true

Size: 1.45 KB

Versions: 18

Compression:

Stored size: 1.45 KB

Contents

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

require_relative "spec_helper"
require "dbus"

describe DBus::ProxyObject do
  around(:each) do |example|
    with_private_bus do
      with_service_by_activation(&example)
    end
  end

  let(:bus) { DBus::ASessionBus.new }

  context "when calling org.ruby.service" do
    let(:svc) { bus["org.ruby.service"] }

    context "when introspection mode is not specified" do
      describe "#bounce_variant" do
        it "works without an explicit #introspect call" do
          obj = svc["/org/ruby/MyInstance"]
          ifc = obj["org.ruby.SampleInterface"]
          expect(ifc.bounce_variant(42)).to be_eql 42
        end

        it "works with one #introspect call" do
          obj = svc["/org/ruby/MyInstance"]
          obj.introspect
          ifc = obj["org.ruby.SampleInterface"]
          expect(ifc.bounce_variant(42)).to be_eql 42
        end

        it "works with two #introspect calls" do
          obj = svc["/org/ruby/MyInstance"]
          obj.introspect
          obj.introspect
          ifc = obj["org.ruby.SampleInterface"]
          expect(ifc.bounce_variant(42)).to be_eql 42
        end
      end
    end

    describe "#[]" do
      it "raises when the interface is not found" do
        obj = svc["/org/ruby/MyInstance"]
        expect { obj["org.ruby.NoSuchInterface"] }.to raise_error(DBus::Error) do |e|
          expect(e.message).to match(/no such interface/)
        end
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
ruby-dbus-0.24.0 spec/proxy_object_spec.rb
ruby-dbus-0.23.1 spec/proxy_object_spec.rb
ruby-dbus-0.23.0.beta2 spec/proxy_object_spec.rb
ruby-dbus-0.23.0.beta1 spec/proxy_object_spec.rb
ruby-dbus-0.22.1 spec/proxy_object_spec.rb
ruby-dbus-0.22.0 spec/proxy_object_spec.rb
ruby-dbus-0.21.0 spec/proxy_object_spec.rb
ruby-dbus-0.20.0 spec/proxy_object_spec.rb
ruby-dbus-0.19.0 spec/proxy_object_spec.rb
ruby-dbus-0.18.1 spec/proxy_object_spec.rb
ruby-dbus-0.18.0.beta8 spec/proxy_object_spec.rb
ruby-dbus-0.18.0.beta7 spec/proxy_object_spec.rb
ruby-dbus-0.18.0.beta6 spec/proxy_object_spec.rb
ruby-dbus-0.18.0.beta5 spec/proxy_object_spec.rb
ruby-dbus-0.18.0.beta4 spec/proxy_object_spec.rb
ruby-dbus-0.18.0.beta3 spec/proxy_object_spec.rb
ruby-dbus-0.18.0.beta2 spec/proxy_object_spec.rb
ruby-dbus-0.18.0.beta1 spec/proxy_object_spec.rb