Forum: Ruby on Rails posting xml in functional test

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
977471a7792cba5ccfbd569f77d805b8?d=identicon&s=25 justin worrall (Guest)
on 2006-05-06 00:58
(Received via mailing list)
Hello,

I'm trying to write a functional test for a simple CRUD controller which
accepts / emits xml in a REST- like fashion. However the following code
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

Anyone give me a hint where I'm going wrong ?

thanks in advance
D0cd6b10e01bacb976b3b815a9c660bc?d=identicon&s=25 Alex Wayne (Guest)
on 2006-05-06 01:54
justin worrall wrote:
> Hello,
>
> I'm trying to write a functional test for a simple CRUD controller which
> accepts / emits xml in a REST- like fashion. However the following code
> 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
>
> Anyone give me a hint where I'm going wrong ?
>
> thanks in advance

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

And if "an exception is generated" then it would be good to knwo the
details of said exception.
This topic is locked and can not be replied to.