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
Message from discussion Functional testing Rails controllers with RubyAMF?
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
 
David Spurr  
View profile  
 More options Feb 27 2008, 8:58 pm
From: David Spurr <david.sp...@gmail.com>
Date: Wed, 27 Feb 2008 17:58:31 -0800 (PST)
Local: Wed, Feb 27 2008 8:58 pm
Subject: Re: Functional testing Rails controllers with RubyAMF?
Well I'm trying to knock together some sort of helper that would aid
functional testing with RubyAMF.

My idea goes along the lines of this:

Have a helper that defines a post_amf method, using this from your
functional tests would be just like using the standard post method.

Inside the post_amf method it switches out the controller your testing
for the amf controller and sets things up e.g.:

  amf_post :index, [ :param = 'something' ]

 1. Serializes the request, with the source set to the name of the
controller your testing & the method name to the one you passed in and
the params put into the body.
 2. Switches out the @controller for the amf controller
 3. Set anything else up set as the content type on the request
 4. Calls the gateway method on the amf controller with the params
(which should now be serialized to amf)
 5. Switches back the @controller to what it was

If that works then that 'should' be calling the amf gateway with
exactly what it needs and everything 'should' be doing things as if
they were a normal request.

Then you would also need a helper method to test that the response was
AMF (e.g. used the format.amf) and something to convert that (or do it
after the end of the send) back to something you can test.

I know I'm over-simplifying things there (as I have spent the past
couple of hours trying to get my head around how Rails functional
tests mock out the requests and RubyAMF works to do the above) and I
haven't gotten very far see the pastie code: http://pastie.caboo.se/158549

That code has it calling the gateway how I envisioned it, but I'm
really stuck on trying to serialize something that the gateway would
accept as a valid amf request.


 
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.