This project is archived and is in readonly mode.

#3887 ✓stale
will bailey

UploadedTestFile should respond_to? :read and other tempfile methods

Reported by will bailey | February 7th, 2010 @ 07:20 PM

I discovered this bug while testing file uploading in an app I'm working on. While accessing the uploaded data I'm differentiating between String and StringIO/TempFile by checking if the object respond_to?(:read). In testing with TestUploadedFile I discovered that it does not correctly report that it respond_to?(:read) as this is handled through method missing. This patch runs the respond_to? on the tempfile as well as the TestUploadedFile yielding a result that more closely matches what you see in an actual request.

Comments and changes to this ticket

  • Nikos Dimitrakopoulos

    Nikos Dimitrakopoulos June 8th, 2010 @ 02:26 PM

    • Tag set to bug, patch, testing

    This bit me too and I was about to send a similar patch.

    +1

    Thanks Will

  • Nikos Dimitrakopoulos

    Nikos Dimitrakopoulos June 21st, 2010 @ 10:25 AM

    One fix to your patch: you should use original_respond_to instead of respond_to.

  • José Valim

    José Valim June 22nd, 2010 @ 04:47 PM

    I believe there is no need to use aliases, you can simply call super.

  • Santiago Pastorino

    Santiago Pastorino February 2nd, 2011 @ 05:02 PM

    • State changed from “new” to “open”
    • Importance changed from “” to “Low”

    This issue has been automatically marked as stale because it has not been commented on for at least three months.

    The resources of the Rails core team are limited, and so we are asking for your help. If you can still reproduce this error on the 3-0-stable branch or on master, please reply with all of the information you have about it and add "[state:open]" to your comment. This will reopen the ticket for review. Likewise, if you feel that this is a very important feature for Rails to include, please reply with your explanation so we can consider it.

    Thank you for all your contributions, and we hope you will understand this step to focus our efforts where they are most helpful.

  • Santiago Pastorino

    Santiago Pastorino February 2nd, 2011 @ 05:02 PM

    • State changed from “open” to “stale”

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Attachments

Pages