I have implemented an API to be used like
curl -X POST -H 'Content-type: application/xml' -d '<user><login>john</
login><password>123456</password></user>' http://0.0.0.0:3000/users/register
and the above call works like charm. However, I can't figure out how
to test this. The best I could come up with is using an integration
test like:
def test_user_registration
assert_difference('User.count') do
xml = '<user>
<login>phibo</login>
<email>[email protected]</email>
<password>somesecret</password>
</user>'
post_via_redirect 'users/register', :user => xml, :content_type =>
'application/xml'
end
end
This test actually calls the correct method on the users_controller,
however, the params[:user] yields unparsed XML instead of the usual
hash. Any idea how to do this?
(Yes, I do plan to use cucumber, rspec and webrat in the future, but
for now I have to do it the hard way..)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---