Class: Downstream::HaveEnqueuedAsyncSubscriberFor

Inherits:
RSpec::Rails::Matchers::ActiveJob::HaveEnqueuedJob
  • Object
show all
Defined in:
lib/downstream/rspec/have_enqueued_async_subscriber_for.rb

Defined Under Namespace

Classes: EventMatcher

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(callable) ⇒ HaveEnqueuedAsyncSubscriberFor

Returns a new instance of HaveEnqueuedAsyncSubscriberFor.



27
28
29
30
# File 'lib/downstream/rspec/have_enqueued_async_subscriber_for.rb', line 27

def initialize(callable)
  @callable = callable
  super(SubscriberJob)
end

Instance Attribute Details

#callableObject (readonly)

Returns the value of attribute callable.



25
26
27
# File 'lib/downstream/rspec/have_enqueued_async_subscriber_for.rb', line 25

def callable
  @callable
end

Instance Method Details

#matches?(proc) ⇒ Boolean

Returns:

  • (Boolean)

Raises:

  • (ArgumentError)


36
37
38
39
# File 'lib/downstream/rspec/have_enqueued_async_subscriber_for.rb', line 36

def matches?(proc)
  raise ArgumentError, "have_enqueued_async_subscriber_for only supports block expectations" unless Proc === proc
  super
end

#with(event) ⇒ Object



32
33
34
# File 'lib/downstream/rspec/have_enqueued_async_subscriber_for.rb', line 32

def with(event)
  super(EventMatcher.new(event), callable.name)
end