Sha256: ef7271fc91f2c7b54a7db1ca9c509f99da5af22ee02a674bf52875d42a97c741

Contents?: true

Size: 1.21 KB

Versions: 6

Compression:

Stored size: 1.21 KB

Contents

#!/usr/bin/env rspec
# 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

6 entries across 6 versions & 1 rubygems

Version Path
ruby-dbus-0.17.0 spec/bus_and_xml_backend_spec.rb
ruby-dbus-0.16.0 spec/bus_and_xml_backend_spec.rb
ruby-dbus-0.15.0 spec/bus_and_xml_backend_spec.rb
ruby-dbus-0.14.1 spec/bus_and_xml_backend_spec.rb
ruby-dbus-0.14.0 spec/bus_and_xml_backend_spec.rb
ruby-dbus-0.13.0 spec/bus_and_xml_backend_spec.rb