class MultipartParamsParsingTest

Constants

FIXTURE_PATH

Public Instance Methods

teardown() click to toggle source
# File actionpack/test/dispatch/request/multipart_params_parsing_test.rb, line 28
def teardown
  TestController.last_request_parameters = nil
end

Private Instance Methods

fixture(name) click to toggle source
# File actionpack/test/dispatch/request/multipart_params_parsing_test.rb, line 175
def fixture(name)
  File.open(File.join(FIXTURE_PATH, name), "rb") do |file|
    { "rack.input" => file.read,
      "CONTENT_TYPE" => "multipart/form-data; boundary=AaB03x",
      "CONTENT_LENGTH" => file.stat.size.to_s }
  end
end
parse_multipart(name) click to toggle source
# File actionpack/test/dispatch/request/multipart_params_parsing_test.rb, line 183
def parse_multipart(name)
  with_test_routing do
    headers = fixture(name)
    post "/parse", params: headers.delete("rack.input"), headers: headers
    assert_response :ok
    TestController.last_request_parameters
  end
end
with_test_routing() { || ... } click to toggle source
# File actionpack/test/dispatch/request/multipart_params_parsing_test.rb, line 192
def with_test_routing
  with_routing do |set|
    set.draw do
      ActiveSupport::Deprecation.silence do
        post ":action", controller: "multipart_params_parsing_test/test"
      end
    end
    yield
  end
end