Test downloading stuff

Guys,

Anybody know how to test the downloading stuff .. ?

What downloading stuff?

Colin

@hemant what kind of crap question is this? be clear on your question

Balasubramaniam Muthaiah wrote:

@hemant what kind of crap question is this? be clear on your question

Hey what i mean was is that i have an link to pdf file.. and when i
click on it in firefox, it prompts me to download the file..
(Development phase)

Now i want to write a test for it(Test phase) just to check that is that
downloading stuff is working fine or not.. Got it..

I would suggest that you write the test first and then code. :slight_smile:

This test code would be in your functional tests which exercise
the controller.

You will need to do the get request for the file and then have
your assertions check that what you get back is what you expect,
a PDF file in this case.

More info here:

http://guides.rubyonrails.org/testing.html#functional-tests-for-your-controllers

Have fun.

Balasubramaniam Muthaiah wrote:

@hemant what kind of crap question is this? be clear on your question

Hey what i mean was is that i have an link to pdf file.. and when i
click on it in firefox, it prompts me to download the file..
(Development phase)

Do you mean it is literally just a link to a pdf file? If so then
just check that the link is there on the page (using assert_select or
equivalent for whatever testing tools you are using). There is
nothing else to test.

Colin