pipedrive: fix deals when no deals are returned
This commit is contained in:
parent
132919260d
commit
d1301762d4
3 changed files with 30 additions and 2 deletions
27
spec/lib/pipedrive/deal_adapter_spec.rb
Normal file
27
spec/lib/pipedrive/deal_adapter_spec.rb
Normal file
|
@ -0,0 +1,27 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe Pipedrive::DealAdapter do
|
||||
let(:url) { PIPEDRIVE_API_URL }
|
||||
let(:status) { 200 }
|
||||
let(:body) { '{}' }
|
||||
|
||||
before do
|
||||
stub_request(:get, url)
|
||||
.to_return(status: status, body: body)
|
||||
end
|
||||
|
||||
describe ".get_deals_ids_for_person" do
|
||||
let(:url) { %r{/persons/1/deals\?*} }
|
||||
subject { Pipedrive::DealAdapter.get_deals_ids_for_person('1') }
|
||||
|
||||
context "with valid data" do
|
||||
let(:body) { '{ "success": true, "data": [ { "id": 34 }, { "id": 35 } ] }' }
|
||||
it { is_expected.to eq [34, 35] }
|
||||
end
|
||||
|
||||
context "when no data are returned" do
|
||||
let(:body) { '{ "success": true, "data": null }' }
|
||||
it { is_expected.to eq [] }
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue