Testing ActiveResource models with HttpMock

Hi all,

I have already spent (too) many hours trying to wire HttpMock in my
test suite and I am stuck. I'm setting up my "remote fixtures" using
a technique quite similar to what's described here:
but even the simplest of my test requests are not accepted. I always
bump into "ActiveResource::InvalidRequestError: No response recorded
for ..."

I see two problems:

1. The real API requires HTTP Basic Authentication so all my client
requests include an authorization header which I've added to my
request. But as there's no documentation at all about how to do this,
I might be mistaken. I am adding the expected request header as

     request_headers = {
       'Authorization' => 'Basic REPLACEDBUTYOUGETTHEIDEA=='

     ActiveResource::HttpMock.respond_to do |mock|
       mock.get "/contacts.xml", request_headers, load_remote_fixtures

2. I am wondering if this bug http://codeintensity.blogspot.com/2007/05/bug-in-activeresources-httpmock.html
has actually ever been fixed, looking at HttpMock's code, I don't see
how the ordering of the hash key is guaranteed, unless there's some
more ActiveSupport magic involved (but I don't think so).

Any help about this will be greatly appreciated. If I judge by the
number of results returned by my various Google searches on that
topic, it seems like there are not many people using ActiveResource
testing... or only a bunch unlucky few have problems with it. :wink:



I just wrote a blog post summarizing what I could find, and how we are
going to address the problem of testing (hit a real server with the AR


-- Chad