Sha256: 810ef3a8c2eef4abcbf12953921e1fc1a7e2d0f4f647a11a85ab801ff27d558f

Contents?: true

Size: 880 Bytes

Versions: 6

Compression:

Stored size: 880 Bytes

Contents

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

require_relative "spec_helper"
require "dbus"

# Pedantic full coverage test.
# The happy paths are covered via calling classes
describe DBus::RawMessage do
  describe ".endianness" do
    it "returns :little for 'l'" do
      expect(described_class.endianness("l")).to eq :little
    end

    it "returns :big for 'B'" do
      expect(described_class.endianness("B")).to eq :big
    end

    it "raises for other strings" do
      expect { described_class.endianness("m") }
        .to raise_error(DBus::InvalidPacketException, /Incorrect endianness/)
    end
  end

  describe "#align" do
    it "raises for values other than 1 2 4 8" do
      subject = described_class.new("l")
      expect { subject.align(3) }.to raise_error(ArgumentError)
      expect { subject.align(16) }.to raise_error(ArgumentError)
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ruby-dbus-0.23.1 spec/raw_message_spec.rb
ruby-dbus-0.23.0.beta2 spec/raw_message_spec.rb
ruby-dbus-0.23.0.beta1 spec/raw_message_spec.rb
ruby-dbus-0.22.1 spec/raw_message_spec.rb
ruby-dbus-0.22.0 spec/raw_message_spec.rb
ruby-dbus-0.21.0 spec/raw_message_spec.rb