Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Testing ActiveResource models with HttpMock
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  2 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Xavier  
View profile  
 More options Nov 20 2008, 5:11 am
From: Xavier <xavier.defr...@gmail.com>
Date: Thu, 20 Nov 2008 02:11:12 -0800 (PST)
Local: Thurs, Nov 20 2008 5:11 am
Subject: 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:
http://giantrobots.thoughtbot.com/2007/2/2/activeresource-and-testing
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
follow:

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

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

2. I am wondering if this bug http://codeintensity.blogspot.com/2007/05/bug-in-activeresources-http...
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. ;)

Regards,

Xavier


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Chad Woolley  
View profile  
 More options Jan 8 2009, 8:21 pm
From: "Chad Woolley" <thewoolley...@gmail.com>
Date: Thu, 8 Jan 2009 18:21:42 -0700
Local: Thurs, Jan 8 2009 8:21 pm
Subject: Re: [Rails] Testing ActiveResource models with HttpMock

On Thu, Nov 20, 2008 at 3:11 AM, Xavier <xavier.defr...@gmail.com> wrote:
> 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. ;)

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
client):

http://pivotallabs.com/users/chad/blog/articles/656-automated-end-to-...

-- Chad


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »