Sha256: 355b2d4e87d2d454c4ab2f06d6ff4264c61a66400b9836e00024b351fe9fc3ba

Contents?: true

Size: 722 Bytes

Versions: 10

Compression:

Stored size: 722 Bytes

Contents

require 'spec_helper'

describe Killbill::Plugin::ActiveMerchant::Utils do
  it "should convert back and forth UUIDs" do
    uuid = SecureRandom.uuid
    packed = Killbill::Plugin::ActiveMerchant::Utils.compact_uuid(uuid)
    unpacked = Killbill::Plugin::ActiveMerchant::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::Plugin::ActiveMerchant::Utils.compact_uuid(uuid)
      unpacked = Killbill::Plugin::ActiveMerchant::Utils.unpack_uuid(packed)
      unpacked.should == uuid
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
killbill-3.1.9 spec/killbill/helpers/utils_spec.rb
killbill-3.1.8 spec/killbill/helpers/utils_spec.rb
killbill-3.1.7 spec/killbill/helpers/utils_spec.rb
killbill-3.1.6 spec/killbill/helpers/utils_spec.rb
killbill-3.1.5 spec/killbill/helpers/utils_spec.rb
killbill-3.1.4 spec/killbill/helpers/utils_spec.rb
killbill-3.1.3 spec/killbill/helpers/utils_spec.rb
killbill-3.1.2 spec/killbill/helpers/utils_spec.rb
killbill-3.1.1 spec/killbill/helpers/utils_spec.rb
killbill-3.1.0 spec/killbill/helpers/utils_spec.rb