Skip to content

Commit

Permalink
Updated to use 18 character Salesforce ID
Browse files Browse the repository at this point in the history
Conflicts:

    Gemfile (ignored johnknott's change)
  • Loading branch information
johnknott authored and jpr5 committed Apr 13, 2012
1 parent 092818c commit a9c850c
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion lib/dm-salesforce-adapter/adapter.rb
Expand Up @@ -165,7 +165,7 @@ def make_salesforce_obj(from, with_attrs)
def normalize_id_value(klass, property, value)
return nil unless value
properties = Array(klass.send(:salesforce_id_properties)).map { |p| p.to_sym } rescue []
return properties.include?(property.name) ? value[0..14] : value
return properties.include?(property.name) ? value[0..17] : value
end
end

Expand Down
4 changes: 2 additions & 2 deletions lib/dm-salesforce-adapter/property/serial.rb
Expand Up @@ -3,10 +3,10 @@ class Serial < ::DataMapper::Property::String
accept_options :serial
serial true

length 15
length 18

def dump(value)
value[0..14] unless value.blank?
value[0..17] unless value.blank?
end
end
end
8 changes: 4 additions & 4 deletions spec/models/account_spec.rb
Expand Up @@ -6,8 +6,8 @@
it "return the first element" do
Account.first.should_not be_nil
end
it "has a 15 character long id" do
Account.first.id.size.should == 15
it "has a 18 character long id" do
Account.first.id.size.should == 18
end
end

Expand All @@ -26,8 +26,8 @@
end
describe "successful creation" do
let(:account) { Account.create(:name => "Adidas Corporation") }
it "has a 15 character long id" do
account.id.size.should == 15
it "has a 18 character long id" do
account.id.size.should == 18
end
it 'is not active by default' do
account.active.should_not be_true
Expand Down
8 changes: 4 additions & 4 deletions spec/models/contact_spec.rb
Expand Up @@ -7,14 +7,14 @@
Contact.first(:id => valid_id).should_not be_nil
end

it "has a 15 character long id" do
it "has a 18 character long id" do
#pending "testing serial types should be done elsewhere"
Contact.first(:id => valid_id).id.size.should == 15
Contact.first(:id => valid_id).id.size.should == 18
end

it "has a 15 character long account_id" do
it "has a 18 character long account_id" do
#pending "testing association ids as serial types should be done elsewhere"
Contact.first(:id => valid_id).account_id.size.should == 15
Contact.first(:id => valid_id).account_id.size.should == 18
end

it "should get a single contact" do
Expand Down

0 comments on commit a9c850c

Please sign in to comment.