# Mocking/stubbing ferret

**URL:** <https://www.ruby-forum.com/t/mocking-stubbing-ferret/81413>\
**Category:** Ferret\
**Created:** [January 8, 2007, 10:44pm UTC](https://www.ruby-forum.com/t/mocking-stubbing-ferret/81413 "2007-01-08T22:44:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![johnnybutler7](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/8491ac/32.png) [@johnnybutler7](https://www.ruby-forum.com/u/johnnybutler7)\
**Post date:** [January 8, 2007, 10:44pm UTC](https://www.ruby-forum.com/t/mocking-stubbing-ferret/81413/1 "2007-01-08T22:44:52Z")

</div>

Does anyone have an experience with mocking/stubbing ferret, in order  
to increase speed? I’ve taken a look at what it might entail and from  
what I’ve seen it would have to be a pretty elaborate system. But I  
am not very experienced with mocking/stubbing.

Any tips much appreciated.

John

---

<div class="post-metadata">

**Author:** ![johnnybutler7](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/8491ac/32.png) [@johnnybutler7](https://www.ruby-forum.com/u/johnnybutler7)\
**Post date:** [November 6, 2007, 11:31am UTC](https://www.ruby-forum.com/t/mocking-stubbing-ferret/81413/2 "2007-11-06T11:31:53Z")

</div>

I assume you are talking about test performance? Rails? acts\_as\_ferret?

In our rails controller tests we basically test that the controller is  
calling ferret with the correct query

For example let’s say we have the model Job

class Job  
acts\_as\_ferret {blah}  
end

in the test

Job.expects(:find\_by\_contents).with(“keyword”).returns(whatever)  
post :search, :query =\> “keyword”
