spec/concerns/crud_activities_spec.rb in mrkt-0.9.0 vs spec/concerns/crud_activities_spec.rb in mrkt-0.10.0

- old
+ new

@@ -108,11 +108,11 @@ end subject { client.get_activities(token) } before do stub_request(:get, "https://#{host}/rest/v1/activities.json") - .with(query: { nextPageToken: URI.encode(token) }) + .with(query: { nextPageToken: token }) .to_return(json_stub(response_stub)) end it { is_expected.to eq(response_stub) } @@ -150,11 +150,11 @@ subject { client.get_activities(token, activity_type_ids: activity_type_ids) } before do stub_request(:get, "https://#{host}/rest/v1/activities.json") .with(query: { - nextPageToken: URI.encode(token), + nextPageToken: token, activityTypeIds: activity_type_ids.join(',') }) .to_return(json_stub(response_stub)) end @@ -194,27 +194,27 @@ end subject { client.get_activities(token, lead_ids: lead_ids) } before do stub_request(:get, "https://#{host}/rest/v1/activities.json") - .with(query: { nextPageToken: URI.encode(token), leadIds: lead_ids.join(',') }) + .with(query: { nextPageToken: token, leadIds: lead_ids.join(',') }) .to_return(json_stub(response_stub)) end it { is_expected.to eq(response_stub) } end context 'specifying arrays values as empty strings' do - let(:activity_type_ids) { "" } - let(:lead_ids) { "" } + let(:activity_type_ids) { '' } + let(:lead_ids) { '' } subject do client.get_activities(token, activity_type_ids: activity_type_ids, lead_ids: lead_ids) end before do stub_request(:get, "https://#{host}/rest/v1/activities.json") - .with(query: { nextPageToken: URI.encode(token) }) + .with(query: { nextPageToken: token }) .to_return(json_stub(response_stub)) end it { is_expected.to eq(response_stub) } end @@ -225,16 +225,55 @@ end before do stub_request(:get, "https://#{host}/rest/v1/activities.json") .with(query: { - nextPageToken: URI.encode(token), + nextPageToken: token, activityTypeIds: activity_type_ids.join(','), leadIds: lead_ids.join(',') }) .to_return(json_stub(response_stub)) end it { is_expected.to eq(response_stub) } end + end + + describe '#get_deleted_leads' do + let(:token) { '4GAX7YNCIJKO2VAED5LH5PQIYPUM7WCVKTQWEDMP2L24AXZT54LA====' } + let(:response_stub) do + { + requestId: '8105#1650074c30c', + result: [ + { + id: 12_751, + marketoGUID: '12751', + leadId: 277, + activityDate: '2018-08-03T14:58:53Z', + activityTypeId: 37, + campaignId: 5227, + primaryAttributeValueId: 277, + primaryAttributeValue: 'Delete Me', + attributes: [ + { + name: 'Campaign', + value: 'Run Action Delete Lead 2018-08-03 04:58:50 pm' + } + ] + } + ], + success: true, + nextPageToken: 'XQH6SLHODNIM7CY6MKJ6GAOR3JYOQXIN3THAHKYZXSOYN4HOPR2Q====', + moreResult: false + } + end + subject { client.get_deleted_leads(token) } + + before do + stub_request(:get, "https://#{host}/rest/v1/activities/deletedleads.json") + .with(query: { nextPageToken: token }) + .to_return(json_stub(response_stub)) + end + + it { is_expected.to eq(response_stub) } end end