Sha256: 81f26917917abbd82f49e434b077e779c3fd97a5377c23edad2ab968a6931153

Contents?: true

Size: 927 Bytes

Versions: 4

Compression:

Stored size: 927 Bytes

Contents

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

require_relative "../coverage_helper"
SimpleCov.command_name "Cockpit Tests (#{Process.pid})" if Object.const_defined? "SimpleCov"

# find the library without external help
$LOAD_PATH.unshift File.expand_path("../../lib", __dir__)
require "dbus"

SERVICE_NAME = "org.rubygems.ruby_dbus.DBusTests"
ROOT_OPATH = "/otree/frobber"

class DBusTests < DBus::Object
  FROBBER_INTERFACE = "com.redhat.Cockpit.DBusTests.Frobber"

  dbus_interface FROBBER_INTERFACE do
    dbus_method :HelloWorld, "in greeting:s, out response:s" do |greeting|
      # TODO: return the same thing as the original implementation
      # and try substituting it?
      [format("Word! You said `%s'. I'm Skeleton, btw!", greeting)]
    end
  end
end

bus = DBus::SessionBus.instance
bus.object_server.export(DBusTests.new(ROOT_OPATH))
bus.request_name(SERVICE_NAME)
DBus::Main.new.tap { |m| m << bus }.run

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ruby-dbus-0.24.0 spec/mock-service/cockpit-dbustests.rb
ruby-dbus-0.23.1 spec/mock-service/cockpit-dbustests.rb
ruby-dbus-0.23.0.beta2 spec/mock-service/cockpit-dbustests.rb
ruby-dbus-0.23.0.beta1 spec/mock-service/cockpit-dbustests.rb