File: proxy_object_interface_spec.rb

package info (click to toggle)
ruby-dbus 0.25.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 776 kB
  • sloc: ruby: 6,584; xml: 225; sh: 38; makefile: 8
file content (35 lines) | stat: -rwxr-xr-x 1,073 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/env rspec
# frozen_string_literal: true

require_relative "spec_helper"
require "dbus"

describe DBus::ProxyObjectInterface do
  # TODO: tag tests that need a service, eg "needs-service"
  # TODO: maybe remove this and rely on a packaged tool
  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"] }

    # This is white box testing, knowing the implementation
    # A better way would be structuring it according to the D-Bus Spec
    # Or testing the service side doing the right thing? (What if our bugs cancel out)
    describe "#define_method_from_descriptor" do
      it "can call a method with multiple OUT arguments" do
        obj = svc["/org/ruby/MyInstance"]
        ifc = obj["org.ruby.SampleInterface"]

        even, odd = ifc.EvenOdd([3, 1, 4, 1, 5, 9, 2, 6])
        expect(even).to eq [4, 2, 6]
        expect(odd).to eq [3, 1, 1, 5, 9]
      end
    end
  end
end