Forum: Ruby on Rails Re: posting xml in functional test

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
justin worrall (Guest)
on 2006-05-06 18:17
(Received via mailing list)
> If "an exception is generated" then it would be good to knwo the
details of said exception.
Sorry - here it is

1) Error:
NoMethodError: undefined method `symbolize_keys' for
    test/functional/person _controller_test.rb:21:in `test_person'

> I'm not sure how to fix it but I believe you stuck that xml in the post
query string, not the post body.

I agree, that looks likely. Can someone tell me how to add data to the
post body, or point me in the direction of the approproate docs ?


>* Hello,
*>* I'm trying to write a functional test for a simple CRUD controller
*>* accepts / emits xml in a REST- like fashion. However the following
*>* won't work for me - an exception is generated
*>* def test_create
*>*   post :create, '<person><name>john</name></person>',
*>* {'Content-Type'=>'application/xml'}
*>*   assert_response 200
*>* end
**> thanks in advance*
Alex W. (Guest)
on 2006-05-07 03:12
justin worrall wrote:
> 1) Error:
> test_create(PersonControllerTest):
> NoMethodError: undefined method `symbolize_keys' for
> "<person><name>John</name></persion>":String

Yes, it definately wants a hash in that spot, not a string.  Maybe the
rails post method simply doesnt support request bodies?  If so, that
would be sad, as there would be no way to test REST.

I'm eagerly awaiting the solution to this as well.
This topic is locked and can not be replied to.