Sha256: 3b90e423cdf4fc6f914021879cc548c7b79344092befac49c53f706c005a4e78

Contents?: true

Size: 1.22 KB

Versions: 10

Compression:

Stored size: 1.22 KB

Contents

require 'abstract_unit'
require 'action_controller/integration'
require 'action_controller/routing'

unless defined? ApplicationController
  class ApplicationController < ActionController::Base
  end
end

class UploadTestController < ActionController::Base
  session :off

  def update
    SessionUploadTest.last_request_type = ActionController::Base.param_parsers[request.content_type]
    render :text => "got here"
  end
end

class SessionUploadTest < ActionController::IntegrationTest
  FILES_DIR = File.dirname(__FILE__) + '/../fixtures/multipart'

  class << self
    attr_accessor :last_request_type
  end

  # def setup
  #   @session = ActionController::Integration::Session.new
  # end
  def test_post_with_upload
    uses_mocha "test_post_with_upload" do
      ActiveSupport::Dependencies.stubs(:load?).returns(false)
      with_routing do |set|
        set.draw do |map|
          map.update 'update', :controller => "upload_test", :action => "update", :method => :post
        end

        params = { :uploaded_data => fixture_file_upload(FILES_DIR + "/mona_lisa.jpg", "image/jpg") }
        post '/update', params, :location => 'blah'
        assert_equal(:multipart_form, SessionUploadTest.last_request_type)
      end
    end
   end
end

Version data entries

10 entries across 9 versions & 4 rubygems

Version Path
radiant-0.7.2 vendor/rails/actionpack/test/controller/integration_upload_test.rb
usher-0.7.0 spec/rails2_2/vendor/rails/vendor/rails/actionpack/pkg/actionpack-2.2.2/test/controller/integration_upload_test.rb
usher-0.7.0 spec/rails2_2/vendor/rails/vendor/rails/actionpack/test/controller/integration_upload_test.rb
actionpack-2.2.3 test/controller/integration_upload_test.rb
actionpack-2.1.1 test/controller/integration_upload_test.rb
actionpack-2.2.2 test/controller/integration_upload_test.rb
actionpack-2.1.2 test/controller/integration_upload_test.rb
eactionpack-2.1.2 test/controller/integration_upload_test.rb
radiant-0.7.0 vendor/rails/actionpack/test/controller/integration_upload_test.rb
radiant-0.7.1 vendor/rails/actionpack/test/controller/integration_upload_test.rb