title: rspec-sidekiq: How to test "within_sidekiq_retries_exhausted_block" with another class method
body: <p>I am using gem "rspec-sidekiq" to test "sidekiq_retries_exhausted".</p>
  
  <p>This is my worker:</p>
  
  <pre><code>class PostListingsWorker
    include Sidekiq::Worker
    sidekiq_options :retry =&gt; 0
  
    sidekiq_retries_exhausted do |msg|
      NotifyMailer.warn_email(msg).deliver_now
    end
  
    def perform(params, fetch_time)
    ....
    end
  end
  </code></pre>
  
  <p>This is an example from "rspec-sidekiq" github:</p>
  
  <pre><code>sidekiq_retries_exhausted do |msg|
    bar('hello')
  end
  # test with...
  FooClass.within_sidekiq_retries_exhausted_block {
    expect(FooClass).to receive(:bar).with('hello')
  }
  </code></pre>
  
  <p>I think it should input methods in "sidekiq_retries_exhausted" block as symbol into test.
  I followed this way, but it doesn't work.</p>
  
  <p>Here is my test.Look at the receive() method.:</p>
  
  <pre><code>it 'should send email when retries exhausted' do
      msg = {error_message: 'Wrong', args: [{id: 1}]}.to_json
      PostListingsWorker.within_sidekiq_retries_exhausted_block(msg) {
        expect(PostListingsWorker).to receive(:"NotifyMailer.warn_email().deliver_now").with(msg)
      }
   end
  </code></pre>
  
  <p>Here is my log:</p>
  
  <pre><code>Failure/Error: expect(PostListingsWorker).to &gt; &gt;
  receive(:"NotifyMailer.warn_email().deliver_now").with(:msg)
  PostListingsWorker does not implement: NotifyMailer.warn_email().deliver_now
  </code></pre>
  
  <p>So，is there any way to test a method belong to another class during "sidekiq_retries_exhausted"?
  Maybe find some way to send method as symblo?</p>