Sha256: b911b6f3742d1c1d4b62bcfd79e463c7b345416dbfd67c93c39cc661d87a129d

Contents?: true

Size: 954 Bytes

Versions: 11

Compression:

Stored size: 954 Bytes

Contents

RSpec.describe Hubspot::CustomEvent do
  before do
    Hubspot.configure(access_token: ENV.fetch("HUBSPOT_ACCESS_TOKEN"), portal_id: ENV.fetch("HUBSPOT_PORTAL_ID"),
                      custom_event_prefix: 'foobar')
  end

  describe '.trigger' do
    let(:event_name) { 'my_awesome_event' }
    let(:email) { 'testingapis@hubspot.com' }
    let(:properties) { { prop_foo: 'bar' } }
    let(:options) { {} }
    let(:base_url) { 'https://api.hubapi.com' }
    let(:url) { "#{base_url}/events/v3/send" }

    subject { described_class.trigger(event_name, email, properties, options) }

    before { stub_request(:post, url).to_return(status: 204, 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
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
hubspot-api-ruby-0.19.0 spec/lib/hubspot/custom_event_spec.rb
hubspot-api-ruby-0.18.0 spec/lib/hubspot/custom_event_spec.rb
hubspot-api-ruby-0.17.1 spec/lib/hubspot/custom_event_spec.rb
hubspot-api-ruby-0.17.0 spec/lib/hubspot/custom_event_spec.rb
hubspot-api-ruby-0.16.0 spec/lib/hubspot/custom_event_spec.rb
hubspot-api-ruby-0.15.0 spec/lib/hubspot/custom_event_spec.rb
hubspot-api-ruby-0.14.0 spec/lib/hubspot/custom_event_spec.rb
hubspot-api-ruby-0.13.0 spec/lib/hubspot/custom_event_spec.rb
hubspot-api-ruby-0.12.0 spec/lib/hubspot/custom_event_spec.rb
hubspot-api-ruby-0.11.0 spec/lib/hubspot/custom_event_spec.rb
hubspot-api-ruby-0.10.0 spec/lib/hubspot/custom_event_spec.rb