File: bus_name_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 1,032 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
require_relative "spec_helper"
require "dbus"

describe DBus::BusName do
  describe ".valid?" do
    it "recognizes valid bus names" do
      expect(described_class.valid?("org.freedesktop.DBus")).to be_truthy
      expect(described_class.valid?(":1.42")).to be_truthy
      expect(described_class.valid?("org._7_zip.Archiver")).to be_truthy
    end

    it "recognizes invalid bus names" do
      expect(described_class.valid?("")).to be_falsey
      expect(described_class.valid?("Empty..Component")).to be_falsey
      expect(described_class.valid?(".Empty.First.Component")).to be_falsey
      expect(described_class.valid?("Empty.Last.Component.")).to be_falsey
      expect(described_class.valid?("Invalid.Ch@r@cter")).to be_falsey
      expect(described_class.valid?("/Invalid-Character")).to be_falsey
      long_name = "a." + ("long." * 100) + "name"
      expect(described_class.valid?(long_name)).to be_falsey
      expect(described_class.valid?("org.7_zip.Archiver")).to be_falsey
    end
  end
end