Testing a controller collaborator


I have the following controller action:

def index
  # Fetch sessions by multiple filters (e.g. filter by track -> params[:track]) 
  @sessions = SessionsFinder.new(current_user, params).execute

I have 1 integration (request) spec that test all the routing and the response body, and multiple ‘unit tests’ to the SessionsFinder class that test all the different filters the user can pass. Will you make a controller spec to assert that this collaborator gets called? Like:

allow(SessionsFinder).to receive(:new)

get :index, track: 'general'

expect(SessionsFinder).to have_received(:new).with(user, track: 'general')