Sha256: 3bc0a634c5387a940f928713e22a8c11e66f026f30d072c2856ab3ae0fd94c5e

Contents?: true

Size: 941 Bytes

Versions: 7

Compression:

Stored size: 941 Bytes

Contents

# frozen_string_literal: true

require 'spec_helper'

RSpec.describe SolidusBolt::Webhooks::CreateService, :vcr, :bolt_configuration do
  describe '#call', vcr: true do
    subject(:create_service) { described_class.call(url: 'https://solidus-test.com/webhook', event: event) }

    before { SolidusBolt::BoltConfiguration.fetch.update(publishable_key: 'abc.def.ghi') }

    context 'with an event' do
      let(:event) { 'payment' }

      it 'returns a webhook id' do
        expect(create_service).to match hash_including('webhook_id')
      end
    end

    context 'with "all" event' do
      let(:event) { 'all' }

      it 'returns a webhook id' do
        expect(create_service).to match hash_including('webhook_id')
      end
    end

    context 'with empty event' do
      let(:event) { '' }

      it 'raises a server error' do
        expect{ create_service }.to raise_error SolidusBolt::ServerError
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
solidus_bolt-0.7.2 spec/services/solidus_bolt/webhooks/create_service_spec.rb
solidus_bolt-0.7.1 spec/services/solidus_bolt/webhooks/create_service_spec.rb
solidus_bolt-0.7.0 spec/services/solidus_bolt/webhooks/create_service_spec.rb
solidus_bolt-0.6.0 spec/services/solidus_bolt/webhooks/create_service_spec.rb
solidus_bolt-0.5.0 spec/services/solidus_bolt/webhooks/create_service_spec.rb
solidus_bolt-0.4.0 spec/services/solidus_bolt/webhooks/create_service_spec.rb
solidus_bolt-0.3.0 spec/services/solidus_bolt/webhooks/create_service_spec.rb