This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Specs for salesforce_id.rb (https://gist.github.com/2691624) | |
# | |
require 'spec_helper' | |
describe SalesforceId do | |
describe 'convert' do | |
before do | |
@sf15 = 'a0D30000001n7Pi' | |
@sf18 = 'a0D30000001n7PiEAC' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Salesforce originally used case-sensitive 15-character IDs. | |
# Later they added three error-correcting characters to make their 18-character ID. | |
# This class converts from one to the other and back | |
# | |
# Usage: | |
# SalesforceId.convert('a0D30000001n7Pi') => 'a0D30000001n7PiEAC' | |
# OR | |
# SalesforceId.convert('a0D30000001n7PiEAC') => 'a0D30000001n7Pi' | |
# SalesforceId.convert('A0d30000001N7pIeAc') => 'a0D30000001n7Pi' | |
# |