This post originated from an RSS feed registered with Ruby Buzz
by Patrick Lenz.
Original Post: Rails tip: Functional testing ajax calls
Feed Title: poocs.net
Feed URL: http://feeds.feedburner.com/poocsnet
Feed Description: Personal weblog about free and open source software, personal development projects and random geek buzz.
Just a quick heads up for those of you who like to functional test their applications and are stuck trying to figure out how to pre-populate what your controllers see as @request.raw_post:
def test_image_assign
@request.env['RAW_POST_DATA'] = "img_1"
post :image_assign,
:id => @first_article.id,
:alignment => "right",
:paragraph_id => 1
assert_response :success
end
(taken from the Ajax-based image assignment function I blogged about earlier)