File: object_path_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 (23 lines) | stat: -rwxr-xr-x 853 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
#!/usr/bin/env rspec
require_relative "spec_helper"
require "dbus"

describe DBus::ObjectPath do
  describe ".valid?" do
    it "recognizes valid paths" do
      expect(described_class.valid?("/")).to be_truthy
      expect(described_class.valid?("/99Numbers/_And_Underscores/anywhere")).to be_truthy
      long_name = "/A23456789" * 42
      # no 255 character limit for object paths
      expect(described_class.valid?(long_name)).to be_truthy
    end

    it "recognizes invalid paths" do
      expect(described_class.valid?("")).to be_falsey
      expect(described_class.valid?("/Empty//Component")).to be_falsey
      expect(described_class.valid?("/EmptyLastComponent/")).to be_falsey
      expect(described_class.valid?("/Invalid Character")).to be_falsey
      expect(described_class.valid?("/Invalid-Character")).to be_falsey
    end
  end
end