Sha256: 1cac5d9b07937ca678af2c88f2f526ce71b09d0c68c65a9d7c876c044b5c4a21

Contents?: true

Size: 637 Bytes

Versions: 11

Compression:

Stored size: 637 Bytes

Contents

require 'spec_helper'

describe Killbill::Litle::Utils do
  it "should convert back and forth UUIDs" do
    uuid = SecureRandom.uuid
    packed = Killbill::Litle::Utils.compact_uuid(uuid)
    unpacked = Killbill::Litle::Utils.unpack_uuid(packed)
    unpacked.should == uuid
  end

  it "should respect leading 0s" do
    uuid = "0ae18a4c-be57-44c3-84ba-a82962a2de03"
    0.upto(35) do |i|
      # Skip hyphens
      next if [8, 13, 18, 23].include?(i)
      uuid[i] = '0'
      packed = Killbill::Litle::Utils.compact_uuid(uuid)
      unpacked = Killbill::Litle::Utils.unpack_uuid(packed)
      unpacked.should == uuid
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
killbill-litle-1.10.0 spec/litle/utils_spec.rb
killbill-litle-1.9.9 spec/litle/utils_spec.rb
killbill-litle-1.9.8 spec/litle/utils_spec.rb
killbill-litle-1.9.7 spec/litle/utils_spec.rb
killbill-litle-1.9.6 spec/litle/utils_spec.rb
killbill-litle-1.9.5 spec/litle/utils_spec.rb
killbill-litle-1.9.4 spec/litle/utils_spec.rb
killbill-litle-1.9.3 spec/litle/utils_spec.rb
killbill-litle-1.9.2 spec/litle/utils_spec.rb
killbill-litle-1.9.1 spec/litle/utils_spec.rb
killbill-litle-1.9.0 spec/litle/utils_spec.rb