Skip to content

Commit

Permalink
Merge pull request #82 from whitecl/opportunity-update-serialization
Browse files Browse the repository at this point in the history
Omit probability when serializing opportunity
  • Loading branch information
mattbeedle committed Sep 30, 2014
2 parents a5e7d1d + b5e4cc8 commit c111cb1
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/capsule_crm/opportunity.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class Opportunity
include CapsuleCRM::Serializable

serializable_config do |config|
config.excluded_keys = [:track_id]
config.excluded_keys = [:track_id, :probability]
end

queryable_config do |config|
Expand Down
21 changes: 21 additions & 0 deletions spec/lib/capsule_crm/opportunity_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,27 @@
end
end

describe '#to_capsule_json' do
let(:opportunity) do
Fabricate.build(:opportunity,
value: 23.0,
currency: 'USD',
probability: 50.0
)
end

subject {opportunity.to_capsule_json['opportunity']}

it { should have_key('name') }
it { should have_key('milestoneId') }
it { should have_key('partyId') }
it { should have_key('value') }
it { should have_key('currency') }

it { should_not have_key('probability')}
it { should_not have_key('trackId')}
end

describe '.deleted' do
before do
stub_request(:get, /.*/).
Expand Down

0 comments on commit c111cb1

Please sign in to comment.