Sha256: 566bfee01e188cb471c245ba62b3713f175356ace56a7829a2758e7752c4156e
Contents?: true
Size: 1.15 KB
Versions: 11
Compression:
Stored size: 1.15 KB
Contents
describe Hubspot::Event do let(:portal_id) { ENV.fetch("HUBSPOT_PORTAL_ID") } let(:sent_portal_id) { portal_id } before { Hubspot.configure(access_token: ENV.fetch("HUBSPOT_ACCESS_TOKEN"), portal_id: portal_id) } describe '.trigger' do let(:event_id) { '000000001625' } let(:email) { 'testingapis@hubspot.com' } let(:options) { {} } let(:base_url) { 'https://track.hubspot.com' } let(:url) { "#{base_url}/v1/event?_n=#{event_id}&_a=#{sent_portal_id}&email=#{CGI.escape email}" } subject { described_class.trigger(event_id, email, options) } before { stub_request(:get, url).to_return(status: 200, body: JSON.generate({})) } it('sends a request to trigger the event') { is_expected.to be true } context 'with headers' do let(:headers) { { 'User-Agent' => 'something' } } let(:options) { { headers: headers } } it('sends headers') { is_expected.to be true } end context 'when overriding portal_id' do let(:sent_portal_id) { '123' } let(:options) { { params: { _a: sent_portal_id } } } it('sends a request to the portal_id in the options') { is_expected.to be true } end end end
Version data entries
11 entries across 11 versions & 1 rubygems