File: client_robustness_spec.rb

package info (click to toggle)
ruby-dbus 0.16.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 520 kB
  • sloc: ruby: 3,786; sh: 53; makefile: 8
file content (25 lines) | stat: -rwxr-xr-x 743 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
#!/usr/bin/env rspec
# Test that a client survives various error cases
require_relative "spec_helper"
require "dbus"

describe "ClientRobustnessTest" do
  before(:each) do
    @bus = DBus::ASessionBus.new
    @svc = @bus.service("org.ruby.service")
  end

  context "when the bus name is invalid" do
    it "tells the user the bus name is invalid" do
      # user mistake, should be "org.ruby.service"
      expect { @bus.service(".org.ruby.service") }.to raise_error(DBus::Error)
    end
  end

  context "when the object path is invalid" do
    it "tells the user the path is invalid" do
      # user mistake, should be "/org/ruby/MyInstance"
      expect { @svc.object("org.ruby.MyInstance") }.to raise_error(DBus::Error)
    end
  end
end