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.

fixture_file_upload no longer available in Tests by default

#1985

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.

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

State: invalid
Milestone: none
Assigned to: josh josh
Importance: none

Activity

  1. grosser.michael+lighthouse (at gmail)
    grosser.michael+lighthouse (at gmail)

    same prblem here, thanks for your solution :)

    February 24th, 2009 @ 01:15 PM

  2. josh
    josh
    • State changed from new to invalid

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

    February 24th, 2009 @ 01:39 PM

  3. Kieran P
    Kieran P
    • 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.

    February 24th, 2009 @ 07:46 PM

  4. josh
    josh

    weird

    
    module ActionController
      class TestCase < ActiveSupport::TestCase
        include TestProcess
    

    February 24th, 2009 @ 07:59 PM

  5. ragaskar
    ragaskar

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

    February 25th, 2009 @ 06:46 AM

  6. Kieran P
    Kieran P

    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.

    February 26th, 2009 @ 08:51 PM

  7. josh
    josh
    • State changed from invalid to open
    • Milestone cleared.

    February 26th, 2009 @ 09:16 PM

  8. Jeremy Kemper
    Jeremy Kemper
    • State changed from open to invalid

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

    February 26th, 2009 @ 10:55 PM

  9. ragaskar
    ragaskar

    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.

    March 1st, 2009 @ 08:50 PM