title: Rails Rspec - How to test if Service has been called in another Service
body: <p>While writing tests, I stopped at trying to test Service in another Service. In such a situation, I should probably just check if Service has been called because it has already been tested elsewhere. I did a little research on the Internet and found something like <code>have_received</code> but I have no idea how to use it in my example.</p>
  <p><code>check_service.rb</code></p>
  <pre><code>Class CheckService
   def initialize(params)
     @params = params
   end
  
   def self.call(params)
     new(params).call
   end
  
   def call
     CheckUser.call(params[:user_id])
   end
  end
  </code></pre>
  <p><code>check_service_spec.rb</code></p>
  <pre><code>...
  
  describe 'call' do
   let(:result) { CheckService.call(params) }
   let(:params) { { user_id: &quot;100&quot; } }
   let(:check_user) { instance_double(CheckUser) }
  
   before do
     allow(check_user).to receive(:call).and_return(true)
   end
  
   it do 
    result
    expect(check_user).to have_received(:call) 
   end
  end
  ...
  </code></pre>
  <p>I was trying something like this (it's simple example), but I get error:</p>
  <pre><code>(InstanceDouble(CheckUser) (anonymous)).call(*(any args))
             expected: 1 time with any arguments
             received: 0 times with any arguments
  </code></pre>
  <p>Is there any option to test situation I presented?</p>