If you have access to a variable @organization(you indicate that you are doing this), you should be able to:
@organization.stub_chain(:topics, :find).and_return(mock_topic)
I don't believe (unless they changed the API to stub_chain, but I don't see anything like this in the docs), you can specify .with ('37 ') when using stub_chain. If you absolutely must indicate which variable is passed to the find method (and this rarely happens), you will have to go a long route:
topics = @organizations.stub!(:topics).and_return(mock_model(Topic))
topics.stub!(:find).with('37').and_return(mock_topic)
source
share