-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #125 from mvidner/two-return-values
Test two OUT arguments
- Loading branch information
Showing
2 changed files
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters