Sha256: 66a74c2d0c759f9ba62f2c5322a492e386d0984c82b3fa76ebe1d8902090590d

Contents?: true

Size: 1.24 KB

Versions: 12

Compression:

Stored size: 1.24 KB

Contents

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

# Test the bus class
require_relative "spec_helper"

require "rubygems"
require "nokogiri"
require "dbus"

describe "BusAndXmlBackendTest" do
  before(:each) do
    @bus = DBus::ASessionBus.new
  end

  it "tests introspection reading rexml" do
    DBus::IntrospectXMLParser.backend = DBus::IntrospectXMLParser::REXMLParser
    @svc = @bus.service("org.ruby.service")
    obj = @svc.object("/org/ruby/MyInstance")
    obj.default_iface = "org.ruby.SampleInterface"
    # "should respond to :the_answer"
    expect(obj.the_answer[0]).to eq(42)
    # "should work with multiple interfaces"
    expect(obj["org.ruby.AnotherInterface"].Reverse("foo")[0]).to eq("oof")
  end

  it "tests introspection reading nokogiri" do
    # peek inside the object to see if a cleanup step worked or not
    DBus::IntrospectXMLParser.backend = DBus::IntrospectXMLParser::NokogiriParser
    @svc = @bus.service("org.ruby.service")
    obj = @svc.object("/org/ruby/MyInstance")
    obj.default_iface = "org.ruby.SampleInterface"
    # "should respond to :the_answer"
    expect(obj.the_answer[0]).to eq(42)
    # "should work with multiple interfaces"
    expect(obj["org.ruby.AnotherInterface"].Reverse("foo")[0]).to eq("oof")
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
ruby-dbus-0.21.0 spec/bus_and_xml_backend_spec.rb
ruby-dbus-0.20.0 spec/bus_and_xml_backend_spec.rb
ruby-dbus-0.19.0 spec/bus_and_xml_backend_spec.rb
ruby-dbus-0.18.1 spec/bus_and_xml_backend_spec.rb
ruby-dbus-0.18.0.beta8 spec/bus_and_xml_backend_spec.rb
ruby-dbus-0.18.0.beta7 spec/bus_and_xml_backend_spec.rb
ruby-dbus-0.18.0.beta6 spec/bus_and_xml_backend_spec.rb
ruby-dbus-0.18.0.beta5 spec/bus_and_xml_backend_spec.rb
ruby-dbus-0.18.0.beta4 spec/bus_and_xml_backend_spec.rb
ruby-dbus-0.18.0.beta3 spec/bus_and_xml_backend_spec.rb
ruby-dbus-0.18.0.beta2 spec/bus_and_xml_backend_spec.rb
ruby-dbus-0.18.0.beta1 spec/bus_and_xml_backend_spec.rb