Franz Strebel wrote:
> Hello folks,
> 
> I need to write a method that will return a PDF to the user.
> 
> Does anyone know of any documentation on how to test
> such functionality?
> 

I haven't needed to do such a thing so I'm of limited help.  I suppose 
if you're doing downloads using rails then you've probably looked at the 
streaming api:
  ActionController::Streaming
The send_data/send_file methods allow you to set the content-type and 
other headers etc etc.

So in your functional tests for your download controller, you could 
probably do something like

  def test_1a
    ...
    get :download , params
    assert_equal 'text/html',@response.headers[:type]
    ...

(Obviously replace 'text/html').
You can also access other headers eg content-length and the body 
(@response.body).
I don't know if it's good form to be using @response.
Integration test api is a little different so might be worth checking 
too.

Daniel
-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
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 rubyonrails-talk@googlegroups.com
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