This project is archived and is in readonly mode.

#1985 ✓invalid
Kieran P

fixture_file_upload no longer available in Tests by default

Reported by Kieran P | February 16th, 2009 @ 05:42 AM

Just upgraded our app from 2.1 to 2.3 and noticed 250 odd unit tests fail because fixture_file_upload is no longer available in Unit Tests.

I had to add 'include ActionController::TestProcess' to the test helper, which fixed it, but I didn't know if the exclusion of it was intentional or accidental so I thought I'd report it.

Comments and changes to this ticket

  • grosser.michael+lighthouse (at gmail)

    grosser.michael+lighthouse (at gmail) February 24th, 2009 @ 01:15 PM

    same prblem here, thanks for your solution :)

  • josh

    josh February 24th, 2009 @ 01:39 PM

    • State changed from “new” to “invalid”

    You need to either inherit from ActiveSupport::TestCase or ActionController::TestCase to get these helpers.

  • Kieran P

    Kieran P February 24th, 2009 @ 07:46 PM

    • Assigned user set to “josh”

    I was. That's the weird thing. I updated all our tests to inherit from the correct classes that a new 2.3 app sets up for scaffold'd data. (i.e. the two classes you mentioned).

    The method was not available until I added the include line.

  • josh

    josh February 24th, 2009 @ 07:59 PM

    weird

    
    module ActionController
      class TestCase < ActiveSupport::TestCase
        include TestProcess
    
  • ragaskar

    ragaskar February 25th, 2009 @ 06:46 AM

    I encountered the same error. Using rspec. Adding 'include ActionController::TestProcess' to my spec_helper fixed it for me as well.

  • Kieran P

    Kieran P February 26th, 2009 @ 08:51 PM

    Joshua, to be more precise, it's ActiveSupport::TestCase that doesn't have this method included automatically (unit tests). The functionals, which use ActionController::TestCase don't have this problem (because as you mentioned, it includes TestProcess). Thus, why doing this fixes it:

    class ActiveSupport::TestCase
      include ActionController::TestProcess
    end
    
    

    I'm attaching a diff which resolves this issue within Rails.

  • josh

    josh February 26th, 2009 @ 09:16 PM

    • State changed from “invalid” to “open”
    • Milestone cleared.
  • Jeremy Kemper

    Jeremy Kemper February 26th, 2009 @ 10:55 PM

    • State changed from “open” to “invalid”

    This is a controller concern, so it's part of ActionController::TestCase

  • ragaskar

    ragaskar March 1st, 2009 @ 08:50 PM

    So my problems were rspec-releated: apparently rspec does not load controller behaviors unless the spec file is in spec/controllers. Moving all tests to spec/controllers allowed me to pull the include workaround out of my spec_helper. My specs were converted from testunit and had some outdated naming conventions, I guess.

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>

People watching this ticket

Attachments

Pages