# ActiveResource Mock Objects

**URL:** <https://www.ruby-forum.com/t/activeresource-mock-objects/188666>\
**Category:** Rails\
**Created:** [May 15, 2010, 10:13pm UTC](https://www.ruby-forum.com/t/activeresource-mock-objects/188666 "2010-05-15T22:13:36Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [May 15, 2010, 10:13pm UTC](https://www.ruby-forum.com/t/activeresource-mock-objects/188666/1 "2010-05-15T22:13:36Z")

</div>

Some of my tests use ActiveResource HttpMock requests and some of them  
do not. Does anyone know if there is a way to disable the HttpMocks  
after they have already been loaded? The method  
ActiveResource::HttpMock.reset! only removes all the objects, but  
ActiveResource still thinks it should look for mock requests rather  
than actually making requests. I hope this makes sense!

Thanks,  
Tom

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [May 15, 2010, 10:34pm UTC](https://www.ruby-forum.com/t/activeresource-mock-objects/188666/2 "2010-05-15T22:34:05Z")

</div>

A little more information: the problem is once you require  
‘active\_resource/http\_mock’ all subsequent tests will assume http  
mocks exists. This makes it so I can’t run my tests with rake.

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [May 17, 2010, 9:53pm UTC](https://www.ruby-forum.com/t/activeresource-mock-objects/188666/3 "2010-05-17T21:53:58Z")

</div>

No response? Is anyone using HttpMock?

Thanks,  
Tom

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [May 18, 2010, 11:34am UTC](https://www.ruby-forum.com/t/activeresource-mock-objects/188666/4 "2010-05-18T11:34:36Z")

</div>

I haven’t used HttpMock, but I’ve used Fakeweb  
([http://fakeweb.rubyforge.org/](http://fakeweb.rubyforge.org/)) and that will let you setup and reset  
the registry pretty easily:

FakeWeb.clean\_registry

On May 17, 2010, at 3:52 PM, TomRossi7 wrote:

> No response? Is anyone using HttpMock?
> 
> Thanks,  
> Tom

–  
Zach M.

> **[Simple Chatter | Let's Chat About Life, Family and Womanhood!](https://www.simplechatter.com/)**
>
> Simple Chatter is a blog site about Family, Motherhood, Womanhood, Self-Help, Overcoming Obstacles, Faith, Finance, Planning/Organizing and Life Coaching.
