# Test downloading stuff

**URL:** <https://www.ruby-forum.com/t/test-downloading-stuff/187052>\
**Category:** Rails\
**Created:** [April 16, 2010, 9:10am UTC](https://www.ruby-forum.com/t/test-downloading-stuff/187052 "2010-04-16T09:10:25Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![hemantborole](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/b782af/32.png) [@hemantborole](https://www.ruby-forum.com/u/hemantborole)\
**Post date:** [April 16, 2010, 9:10am UTC](https://www.ruby-forum.com/t/test-downloading-stuff/187052/1 "2010-04-16T09:10:25Z")

</div>

Guys,

Anybody know how to test the downloading stuff … ?

---

<div class="post-metadata">

**Author:** ![hemantborole](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/b782af/32.png) [@hemantborole](https://www.ruby-forum.com/u/hemantborole)\
**Post date:** [April 16, 2010, 10:00am UTC](https://www.ruby-forum.com/t/test-downloading-stuff/187052/2 "2010-04-16T10:00:42Z")

</div>

On 16 April 2010 08:10, Hemant B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Guys,
> 
> Anybody know how to test the downloading stuff … ?

What downloading stuff?

Colin

---

<div class="post-metadata">

**Author:** ![hemantborole](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/b782af/32.png) [@hemantborole](https://www.ruby-forum.com/u/hemantborole)\
**Post date:** [April 16, 2010, 10:02am UTC](https://www.ruby-forum.com/t/test-downloading-stuff/187052/3 "2010-04-16T10:02:28Z")

</div>

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

On 16 April 2010 13:29, Colin L. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> You received this message because you are subscribed to the Google G.  
> “Ruby on Rails: Talk” group.  
> To post to this group, send email to removed\_email\_address@domain.invalid.  
> To unsubscribe from this group, send email to  
> removed\_email\_address@domain.invalid[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> .  
> For more options, visit this group at  
> [http://groups.google.com/group/rubyonrails-talk?hl=en](http://groups.google.com/group/rubyonrails-talk?hl=en).

–  
“Smile while you cry.”

“There are only two tragedies in life: one is not getting what one  
wants,  
and the other is getting it.”

---

<div class="post-metadata">

**Author:** ![hemantborole](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/b782af/32.png) [@hemantborole](https://www.ruby-forum.com/u/hemantborole)\
**Post date:** [April 16, 2010, 10:41am UTC](https://www.ruby-forum.com/t/test-downloading-stuff/187052/4 "2010-04-16T10:41:41Z")

</div>

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

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:

> **[Testing Rails Applications — Ruby on Rails Guides](https://guides.rubyonrails.org/testing.html#functional-tests-for-your-controllers)**
>
> Testing Rails ApplicationsThis guide covers built-in mechanisms in Rails for testing your application.After reading this guide, you will know: Rails testing terminology. How to write unit, functional, integration, and system tests for your...

Have fun.

---

<div class="post-metadata">

**Author:** ![hemantborole](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/b782af/32.png) [@hemantborole](https://www.ruby-forum.com/u/hemantborole)\
**Post date:** [April 16, 2010, 10:26am UTC](https://www.ruby-forum.com/t/test-downloading-stuff/187052/5 "2010-04-16T10:26:32Z")

</div>

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…

> –  
> “Smile while you cry.”
> 
> “There are only two tragedies in life: one is not getting what one  
> wants,  
> and the other is getting it.”

---

<div class="post-metadata">

**Author:** ![hemantborole](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/b782af/32.png) [@hemantborole](https://www.ruby-forum.com/u/hemantborole)\
**Post date:** [April 16, 2010, 5:27pm UTC](https://www.ruby-forum.com/t/test-downloading-stuff/187052/6 "2010-04-16T17:27:29Z")

</div>

On 16 April 2010 09:26, Hemant B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> 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
