Skip to main content

Unit/Functional Testing RubyAMF

One of my current projects is using RubyAMF to communicate with Flash ( On the whole this is really nice because it allows you to transfer Ruby objects directly to ActionScript ones (as opposed to translating the object into XML, sending the XML and then recreating the object in ActionScript).

However, Rails does not provide a built in transport mechanism for AMF, so we cannot run functional testing directly on the data call (as we could for an XML or HTML transport layer). This is a show stopper for a lot of people (Rails w/o Unit testing = a big mess of trouble when something goes wrong).

We can though serve both the HTML and the AMF formats depending on the request format. This means that we can test the object instantiation logic and make sure there are no errors in the controllers (though we cannot check the actual format of the data being served).

In the controller, instead of rendering AMF alone, do the following

respond_to do |format|
format.html {render :text => ""}
format.amf { render :amf => @photo }

Note: You will have to give the variable object instance scope using the @ sign so we can test for it

Then in the unit test file, you can test in the following manner

def test_get_photo
get :get_photo
assert_not_nil assigns(:photo)
assert_response :success

So you can at least test that the object got instantiated and no errors were generated.


Unknown said…
Hey, good idea was wondering how to test AMF stuff, thanks for sharing.
Anonymous said…
free single dating service [url=]singer dating personal[/url] dating is murder by susan jane kozak downloadable simulation dating games
Anonymous said…
medical history of the renaissance [url=]epivir[/url] putnam community medical center palatke fl smoking and red blood count
virtua health system [url=]dilantin[/url] better health store [url=]vaginal fluids and smells[/url]
Anonymous said…
scandinavian heart [url=]luvox[/url] penis ring masturbation canada health act and rhpa
health insurance company in the us [url=]flagyl er[/url] carbohydrates in apples [url=]holiday tea receipt[/url]
Anonymous said…
[url=]bare metal stents vs drug eluting[/url] drugs street name surfs [url=]brahmi oil[/url]
pharmacy training program versus no training
[url=]information about the drug trazodone[/url] generic pharmacy online complaints [url=]side effects conjugated linoleic acid[/url]
effects of drugs on pregnancy
[url=]full information levitra[/url] employment pharmacy [url=]canadian bupropion hcl prescription[/url] high pharmacy [url=]bupropion price[/url]
Anonymous said…
[url=]meridia pharmacy low prices[/url] olanzapine drug [url=]health magazine man model[/url]
verapamil drug interaction s
[url=]drugs that make u voice deeper[/url] cialis comparison diflucan viagra [url=]of pravachol[/url]
fda fee new drug
[url=]wacker drug trial kansas boyle[/url] drug information on prednizone [url=]pharmacy technician continuing eduaction[/url] clinical pharmacy software [url=]pain relief medication for tooth abscess[/url]
Anonymous said…
boat travel members alberta find cheap travel insurance
[url=]travel western caribbean[/url] alabama travel baseball teams [url=]harayana tourism[/url]
how many miles per hour can a plane travel
[url=]futura travel mugs[/url] saga travel money [url=]best day to visit disneyland[/url]
travel vail co
[url=]travel mpls to las vegas[/url] the travel market [url=]military discount for plane tickets[/url] travel value rewards program [url=]norweigian cruise jobs[/url]
overseas travel allowance south africa [url=]boeing vs airbus[/url]
travel agents in korea
[url=]travel guatamala[/url] everest travel trailers [url=]holiday inn express in wilmington2c nc[/url]
[url=]discount travel online booking cheap airfare expedia flights[/url] india travel blogs [url=]jamestown pocahontas tours[/url] liberrty travel [url=]guitar amp flight case[/url]
canadian travel insurance for travelling to south america [url=]baricelli inn[/url]
Anonymous said…
travel show hosts travel costa raica
[url=]outback 27 rsd travel trailer[/url] dushi travel [url=]alamo car rental pie[/url]
tuscany passport travel wallet
[url=]video game storage multisystem travel[/url] job novica opening travel [url=]garth brooks come tour[/url]
mitylite travel trailer mexico rv travel paul alton [url=]plane tickets to anchorage[/url]
Anonymous said…
replica prada shoes lebanon fashion clothing [url=]anne taylor clothes[/url] man made clothes women golf shoes [url=]running shoes reviews runners world[/url]
Anonymous said…
womens fitness shoes designer factory outlet uk [url=]fashion show games[/url] infant clothes womens stylish wide width shoes [url=]soccer turf shoes[/url]
Anonymous said…
buy gucci watcg best ever designer foundations [url=]corporate interior designers[/url] grphic designers sexy designer mayernity [url=]new balance shoes[/url]
Anonymous said…
sexy bikini bride
[url=]huge dildo buy[/url] dildo cam [url=]massive cock mature[/url]
xxx sexy tits
[url=]xxx leather crotchless[/url] dildo bobbleheads [url=]adult lesbian sex storier[/url]
sexy longjohns
[url=]pink silicone lubricant[/url] jerking dicks off with lubricant [url=]tom selleck gay[/url]
amateur girlfriend porn
[url=]mature amateur nude gallery[/url] xxx massages [url=]gang band porn[/url]
Anonymous said…
cheap travel exotic mti travel
[url=]how many hours did it take santa to travel around the world[/url] venice italy travel guide [url=]hotel maison 140 los angeles[/url]
toddler travel n trundle
[url=]travel channel extreme christmas[/url] macbeth travel scotland [url=]new stadium tour yankee york htm[/url]
travel lodge at bournemouth uk travel sites to go in the country of oman [url=]dulles airport weather report status[/url]
Anonymous said…
mens health extenze [url=]prinivil[/url] top 10 drug rehabilatation centers
technology and health [url=]anti saure[/url] teen weight loss eating plan [url= ]india producers generic hiv drugs [/url] duke study stored blood heart attacks
city of medical lake [url=]prandin[/url] cosmetic dental surgery tampa
smoking turkey in a brinkman smoker [url=]cholesterol[/url] aetna aarp health plan [url= ]what is drug compounding [/url] breast canser prevention
Anonymous said…
double vaginal double anal [url=]tetracycline[/url] bacteria and neutrophils
borgess health [url=]himcolin[/url] altamonte springs fl health insurance [url= ]allegra d effects [/url] california controlled substance prescription laws
wuyi weight loss [url=]prometrium[/url] ohio ballot issues 2007 november smoking
irvine breast implants [url=]pro erex[/url] board of registry in medicine massachusetts [url= ]teds tea shop [/url] drug counselor training tx
Anonymous said…
childrens high heeled shoes clothes for large men uk [url=]kleines glied und kleine eier[/url] dark brown baby dress shoes gothic clothes [url=]interior designers bristol[/url]
Anonymous said…
plastic surgery vaginal sculpting [url=]stress relief[/url] journal articles bulling and mental health issues in australia
expired codeine cough medicine [url=]erektile dysfunktion[/url] penis diet [url= ]buy tea tree lotion for horses [/url] molecule stress ball
blood pressure and illness [url=]quibron t[/url] depression after flu
calcium oxalate stones diet [url=]hoodia weight loss gum[/url] weight loss patch casino online [url= ]health beliefs of austrlians [/url] breads to eat to lower cholesterol
Anonymous said…
szilvia lauren gucci positano [url=]rhyme for tying shoes[/url] allan fusser clothes working conditions for being a fashion designer [url=]designer picture frames[/url]
Anonymous said…
australian goth clothes hsn and shoes off [url=]web designers derby[/url] free business card designer journey shoes [url=]next clothes[/url]
Anonymous said…
card high counting blackjack player system deck lot recognise gambling in spouses
[url=]nortrh carolina lottery[/url] wife wins lottery then divorces [url=]online casinos that have the game doctor lovemore[/url]
kickapoo traditional tribe of texas lucky eagle casino
[url=]couer d alene casino[/url] free betting tips [url=]slot machine computer game[/url]
royal bingo effexor gambling [url=]gratis baccarat[/url]
Anonymous said…
articles on automobile monitoring using gsm mercedes 550 s
[url=]arca sim racing video framerates[/url] auto loan pre approval [url=]sohc honda[/url]
arctic cat racing snowmobiles for sale
[url=]how many people are killed in automobile accidents in the us[/url] automobile sale prices [url=]saab[/url]
auto engine oil drain
[url=]ford remote automobile starter[/url] dodge intrepide [url=]citroen c2 audio system[/url]
Anonymous said…
celebrity golf outing luncheon bingo smith to play blackjack free
[url=]menominee casino bingo and hotel keshena wi[/url] average number of blackjack hands dealt per hour [url=]how can i watch video of nash bridges season 5 jackpot[/url]
bingo palace
[url=]green valley casino las vegas[/url] final betting results for super bowl xlii [url=]cognac baccarat[/url]
teresa ireland bingo mirage casino and las vegas and swarovsky [url=]printable bingo money[/url]

Popular posts from this blog

Master of my domain

Hi All, I just got myself a new domain ( ). The reason is that is offering cheap domain via and I thought after having this nickname for nigh on 10 years it was time to buy the domain before someone else did (also I read somewhere that using in your domain is the equivalent of an or email address...shudder...). Of course I forgot that I would have to re-register my blog everywhere (which is taking ages) not to mention set up all my stats stuff again. *sigh*. It's a blogger's life... In any case, don't forget to bookmark the new address and to vote me up on Technorati !

Speeding up RSpec

So today I have been looking into getting our enormous battery of tests to run faster. I have yet to find anything that works for Cucumber, but I did find an interesting way to speed up RSpec which is detailed here. Basically, it seems that by not collecting garbage too frequently, you can make your tests run much faster (at the expense of memory management of course). We observed a 30% reduction in the time it takes to run an RSpec test suite. I did try to implement this on Cucumber, however because we need to store much more in memory to set up and tear down our objects, it meant that I kept running out of memory when I wasn't using the default Garbage Collection and the tests took even longer (so, buyer beware). I suppose if you had a small set of features though you might see some benefit.

Elixir - destructuring, function overloading and pattern matching

Why am I covering 3 Elixir topics at once? Well, perhaps it is to show you how the three are used together. Individually, any of these 3 are interesting, but combined, they provide you with a means of essentially getting rid of conditionals and spaghetti logic. Consider the following function. def greet_beatle(person) do case person.first_name do "John" -> "Hello John." "Paul" -> "Good day Paul." "George" -> "Georgie boy, how you doing?" "Ringo" -> "What a drummer!" _-> "You are not a Beatle, #{person.first_name}" end end Yeah, it basically works, but there is a big old case statement in there. If you wanted to do something more as well depending on the person, you could easily end up with some spaghetti logic. Let's see how we can simplify this a little. def greet_beatle(%{first_name: first_name}) do case first_name d