Sha256: 0f1446d4b3c0660ff54faf2be30ceded6f36f13635f5b38e773ea6646493b562

Contents?: true

Size: 685 Bytes

Versions: 4

Compression:

Stored size: 685 Bytes

Contents

# frozen_string_literal: true

module Lita
  module RSpec
    module Matchers
      # RSpec matchers for event routes.
      # @since 4.0.0
      module EventRouteMatcher
        extend ::RSpec::Matchers::DSL

        matcher :route_event do |event_name|
          match do
            callbacks = described_class.event_subscriptions_for(event_name)

            if defined?(@method_name)
              callbacks.any? { |callback| callback.method_name.equal?(@method_name) }
            else
              !callbacks.empty?
            end
          end

          chain :to do |method_name|
            @method_name = method_name
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rita-5.0.0.alpha.4 lib/lita/rspec/matchers/event_route_matcher.rb
rita-5.0.0.alpha.3 lib/lita/rspec/matchers/event_route_matcher.rb
rita-5.0.0.alpha.2 lib/lita/rspec/matchers/event_route_matcher.rb
rita-5.0.0.alpha.1 lib/lita/rspec/matchers/event_route_matcher.rb