Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

UploadedTestFile should respond_to? :read and other tempfile methods

#3887

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.

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

State: stale
Milestone: none
Assigned to: nobody
Importance: Low

Activity

  1. Nikos Dimitrakopoulos
    Nikos Dimitrakopoulos
    • Tag set to bug, patch, testing

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

    +1

    Thanks Will

    June 8th, 2010 @ 02:26 PM

  2. Nikos Dimitrakopoulos
    Nikos Dimitrakopoulos

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

    June 21st, 2010 @ 10:25 AM

  3. José Valim
    José Valim

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

    June 22nd, 2010 @ 04:47 PM

  4. Santiago Pastorino
    Santiago Pastorino
    • 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.

    February 2nd, 2011 @ 05:02 PM

  5. Santiago Pastorino
    Santiago Pastorino
    • State changed from open to stale

    February 2nd, 2011 @ 05:02 PM