# ActiveResource:: HttpMock

**URL:** <https://www.ruby-forum.com/t/activeresource-httpmock/170981>\
**Category:** Rails\
**Created:** [June 24, 2009, 9:38pm UTC](https://www.ruby-forum.com/t/activeresource-httpmock/170981 "2009-06-24T21:38:04Z")\
**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:** [June 24, 2009, 9:38pm UTC](https://www.ruby-forum.com/t/activeresource-httpmock/170981/1 "2009-06-24T21:38:04Z")

</div>

I’m trying to set up testing on my ActiveResource project. The  
HttpMock appears to be what I want, but whenever I use the code in the  
“documentation”, I get the error

NameError: uninitialized constant ActiveResource::HttpMock

Is there something I need to do to enable HttpMock testing?

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:** [June 24, 2009, 9:58pm UTC](https://www.ruby-forum.com/t/activeresource-httpmock/170981/2 "2009-06-24T21:58:36Z")

</div>

I’ve never used HttpMock for testing, but I’d recommend checking out  
Fakeweb  
([http://fakeweb.rubyforge.org/](http://fakeweb.rubyforge.org/)) for testing against external resource. I  
use  
it for ActiveResource calls and for hitting other external APIs.

Hope that helps.

On Wed, Jun 24, 2009 at 2:37 PM, TomRossi7 [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Tom
> 
> >

–  
Christopher W.  
removed\_email\_address@domain.invalid  
612.424.9880

---

<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:** [June 25, 2009, 2:40am UTC](https://www.ruby-forum.com/t/activeresource-httpmock/170981/3 "2009-06-25T02:40:53Z")

</div>

On Wed, Jun 24, 2009 at 2:37 PM, TomRossi7[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I’m trying to set up testing on my ActiveResource project. The  
> HttpMock appears to be what I want, but whenever I use the code in the  
> “documentation”, I get the error
> 
> NameError: uninitialized constant ActiveResource::HttpMock
> 
> Is there something I need to do to enable HttpMock testing?

require ‘active\_resource/http\_mock’ first 😉

jeremy

---

<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:** [June 25, 2009, 3:53am UTC](https://www.ruby-forum.com/t/activeresource-httpmock/170981/4 "2009-06-25T03:53:26Z")

</div>

Oh wow. That was easy. Thanks Jeremy!

p.s. Did you find that documented somewhere?
