Sha256: c7a584aedce77b5803d421179d32e351ef5ddd4a9285226f0f42d573bd4e7455

Contents?: true

Size: 729 Bytes

Versions: 10

Compression:

Stored size: 729 Bytes

Contents

# frozen_string_literal: true
require 'test_helper'

module Shipit
  module Webhooks
    class HandlersTest < ActiveSupport::TestCase
      test 'custom handlers do not replace default shipit handlers' do
        event = 'push'
        mock_handler = mock
        Shipit::Webhooks.register_handler(event, mock_handler)

        assert_includes Shipit::Webhooks.for_event(event), mock_handler
        assert_includes Shipit::Webhooks.for_event(event), Shipit::Webhooks::Handlers::PushHandler

        Shipit::Webhooks.reset_handlers!
      end

      test "unknown events have no handlers" do
        event = '_'

        handlers = Shipit::Webhooks.for_event(event)

        assert_equal [], handlers
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
shipit-engine-0.39.0 test/models/shipit/webhooks/handlers_test.rb
shipit-engine-0.38.0 test/models/shipit/webhooks/handlers_test.rb
shipit-engine-0.37.0 test/models/shipit/webhooks/handlers_test.rb
shipit-engine-0.36.1 test/models/shipit/webhooks/handlers_test.rb
shipit-engine-0.36.0 test/models/shipit/webhooks/handlers_test.rb
shipit-engine-0.35.1 test/models/shipit/webhooks/handlers_test.rb
shipit-engine-0.35.0 test/models/shipit/webhooks/handlers_test.rb
shipit-engine-0.34.0 test/models/shipit/webhooks/handlers_test.rb
shipit-engine-0.33.0 test/models/shipit/webhooks/handlers_test.rb
shipit-engine-0.32.0 test/models/shipit/wehbooks/handlers_test.rb