Simon Macneall wrote:

> I have some functional tests that require XML input that gets set into the
> RAW_POST_DATA. I would like to get the XML for each tests from files (to
> save having lots of XML in my test.rb. Is there anything in the testing
> framework to handle this, or should I just load the file manually?

If you mean the data comes as a file upload, look up the upload_mock plugin ( 
posserbly http://julik.textdriven.com/svn/tools/rails_plugins/upload_mock/ ), 
and add an XML mimetype to it. We use it to test paperclip (which is the best 
way to store uploaded files we have seen so far):

   def test_upload_one_document
     image = MockUpload.new("image.pdf")
     owner = owners(:a_document_owner)

     doc = assert_latest owner.documents do
       post :edit_owner, :owner_id => owner.id, :document => image
     end

     assert{ doc.image_file_name =~ /image.pdf/ }
   end

If you don't mean that, then just write a folder in test/fixtures and put XML 
files in it, then write a test helper method to load them into your params.

-- 
   Phlip


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to