mirror of
https://github.com/TracksApp/tracks.git
synced 2026-01-28 03:36:11 +01:00
Vendoring Rails 2.3.5
This commit is contained in:
parent
3e83d19299
commit
f8779795ce
943 changed files with 56503 additions and 61351 deletions
65
vendor/rails/actionpack/test/controller/request/json_params_parsing_test.rb
vendored
Normal file
65
vendor/rails/actionpack/test/controller/request/json_params_parsing_test.rb
vendored
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
require 'abstract_unit'
|
||||
|
||||
class JsonParamsParsingTest < ActionController::IntegrationTest
|
||||
class TestController < ActionController::Base
|
||||
class << self
|
||||
attr_accessor :last_request_parameters
|
||||
end
|
||||
|
||||
def parse
|
||||
self.class.last_request_parameters = request.request_parameters
|
||||
head :ok
|
||||
end
|
||||
end
|
||||
|
||||
def teardown
|
||||
TestController.last_request_parameters = nil
|
||||
end
|
||||
|
||||
test "parses json params for application json" do
|
||||
assert_parses(
|
||||
{"person" => {"name" => "David"}},
|
||||
"{\"person\": {\"name\": \"David\"}}", { 'CONTENT_TYPE' => 'application/json' }
|
||||
)
|
||||
end
|
||||
|
||||
test "parses json params for application jsonrequest" do
|
||||
assert_parses(
|
||||
{"person" => {"name" => "David"}},
|
||||
"{\"person\": {\"name\": \"David\"}}", { 'CONTENT_TYPE' => 'application/jsonrequest' }
|
||||
)
|
||||
end
|
||||
|
||||
test "logs error if parsing unsuccessful" do
|
||||
with_test_routing do
|
||||
begin
|
||||
$stderr = StringIO.new
|
||||
json = "[\"person]\": {\"name\": \"David\"}}"
|
||||
post "/parse", json, {'CONTENT_TYPE' => 'application/json'}
|
||||
assert_response :error
|
||||
$stderr.rewind && err = $stderr.read
|
||||
assert err =~ /Error occurred while parsing request parameters/
|
||||
ensure
|
||||
$stderr = STDERR
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
def assert_parses(expected, actual, headers = {})
|
||||
with_test_routing do
|
||||
post "/parse", actual, headers
|
||||
assert_response :ok
|
||||
assert_equal(expected, TestController.last_request_parameters)
|
||||
end
|
||||
end
|
||||
|
||||
def with_test_routing
|
||||
with_routing do |set|
|
||||
set.draw do |map|
|
||||
map.connect ':action', :controller => "json_params_parsing_test/test"
|
||||
end
|
||||
yield
|
||||
end
|
||||
end
|
||||
end
|
||||
162
vendor/rails/actionpack/test/controller/request/multipart_params_parsing_test.rb
vendored
Normal file
162
vendor/rails/actionpack/test/controller/request/multipart_params_parsing_test.rb
vendored
Normal file
|
|
@ -0,0 +1,162 @@
|
|||
require 'abstract_unit'
|
||||
|
||||
class MultipartParamsParsingTest < ActionController::IntegrationTest
|
||||
class TestController < ActionController::Base
|
||||
class << self
|
||||
attr_accessor :last_request_parameters
|
||||
end
|
||||
|
||||
def parse
|
||||
self.class.last_request_parameters = request.request_parameters
|
||||
head :ok
|
||||
end
|
||||
|
||||
def read
|
||||
render :text => "File: #{params[:uploaded_data].read}"
|
||||
end
|
||||
end
|
||||
|
||||
FIXTURE_PATH = File.dirname(__FILE__) + '/../../fixtures/multipart'
|
||||
|
||||
def teardown
|
||||
TestController.last_request_parameters = nil
|
||||
end
|
||||
|
||||
test "parses single parameter" do
|
||||
assert_equal({ 'foo' => 'bar' }, parse_multipart('single_parameter'))
|
||||
end
|
||||
|
||||
test "parses bracketed parameters" do
|
||||
assert_equal({ 'foo' => { 'baz' => 'bar'}}, parse_multipart('bracketed_param'))
|
||||
end
|
||||
|
||||
test "parses text file" do
|
||||
params = parse_multipart('text_file')
|
||||
assert_equal %w(file foo), params.keys.sort
|
||||
assert_equal 'bar', params['foo']
|
||||
|
||||
file = params['file']
|
||||
assert_kind_of Tempfile, file
|
||||
assert_equal 'file.txt', file.original_filename
|
||||
assert_equal "text/plain", file.content_type
|
||||
assert_equal 'contents', file.read
|
||||
end
|
||||
|
||||
test "parses boundary problem file" do
|
||||
params = parse_multipart('boundary_problem_file')
|
||||
assert_equal %w(file foo), params.keys.sort
|
||||
|
||||
file = params['file']
|
||||
foo = params['foo']
|
||||
|
||||
assert_kind_of Tempfile, file
|
||||
|
||||
assert_equal 'file.txt', file.original_filename
|
||||
assert_equal "text/plain", file.content_type
|
||||
|
||||
assert_equal 'bar', foo
|
||||
end
|
||||
|
||||
test "parses large text file" do
|
||||
params = parse_multipart('large_text_file')
|
||||
assert_equal %w(file foo), params.keys.sort
|
||||
assert_equal 'bar', params['foo']
|
||||
|
||||
file = params['file']
|
||||
|
||||
assert_kind_of Tempfile, file
|
||||
|
||||
assert_equal 'file.txt', file.original_filename
|
||||
assert_equal "text/plain", file.content_type
|
||||
assert ('a' * 20480) == file.read
|
||||
end
|
||||
|
||||
test "parses binary file" do
|
||||
params = parse_multipart('binary_file')
|
||||
assert_equal %w(file flowers foo), params.keys.sort
|
||||
assert_equal 'bar', params['foo']
|
||||
|
||||
file = params['file']
|
||||
assert_kind_of Tempfile, file
|
||||
assert_equal 'file.csv', file.original_filename
|
||||
assert_nil file.content_type
|
||||
assert_equal 'contents', file.read
|
||||
|
||||
file = params['flowers']
|
||||
assert_kind_of Tempfile, file
|
||||
assert_equal 'flowers.jpg', file.original_filename
|
||||
assert_equal "image/jpeg", file.content_type
|
||||
assert_equal 19512, file.size
|
||||
end
|
||||
|
||||
test "parses mixed files" do
|
||||
params = parse_multipart('mixed_files')
|
||||
assert_equal %w(files foo), params.keys.sort
|
||||
assert_equal 'bar', params['foo']
|
||||
|
||||
# Ruby CGI doesn't handle multipart/mixed for us.
|
||||
files = params['files']
|
||||
assert_kind_of Tempfile, files
|
||||
files.force_encoding('ASCII-8BIT') if files.respond_to?(:force_encoding)
|
||||
assert_equal 19756, files.size
|
||||
end
|
||||
|
||||
test "does not create tempfile if no file has been selected" do
|
||||
params = parse_multipart('none')
|
||||
assert_equal %w(submit-name), params.keys.sort
|
||||
assert_equal 'Larry', params['submit-name']
|
||||
assert_equal nil, params['files']
|
||||
end
|
||||
|
||||
test "parses empty upload file" do
|
||||
params = parse_multipart('empty')
|
||||
assert_equal %w(files submit-name), params.keys.sort
|
||||
assert_equal 'Larry', params['submit-name']
|
||||
assert params['files']
|
||||
assert_equal "", params['files'].read
|
||||
end
|
||||
|
||||
test "uploads and reads binary file" do
|
||||
with_test_routing do
|
||||
fixture = FIXTURE_PATH + "/mona_lisa.jpg"
|
||||
params = { :uploaded_data => fixture_file_upload(fixture, "image/jpg") }
|
||||
post '/read', params
|
||||
expected_length = 'File: '.length + File.size(fixture)
|
||||
assert_equal expected_length, response.content_length
|
||||
end
|
||||
end
|
||||
|
||||
test "uploads and reads file" do
|
||||
with_test_routing do
|
||||
post '/read', :uploaded_data => fixture_file_upload(FIXTURE_PATH + "/hello.txt", "text/plain")
|
||||
assert_equal "File: Hello", response.body
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
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
|
||||
|
||||
def parse_multipart(name)
|
||||
with_test_routing do
|
||||
headers = fixture(name)
|
||||
post "/parse", headers.delete("rack.input"), headers
|
||||
assert_response :ok
|
||||
TestController.last_request_parameters
|
||||
end
|
||||
end
|
||||
|
||||
def with_test_routing
|
||||
with_routing do |set|
|
||||
set.draw do |map|
|
||||
map.connect ':action', :controller => "multipart_params_parsing_test/test"
|
||||
end
|
||||
yield
|
||||
end
|
||||
end
|
||||
end
|
||||
120
vendor/rails/actionpack/test/controller/request/query_string_parsing_test.rb
vendored
Normal file
120
vendor/rails/actionpack/test/controller/request/query_string_parsing_test.rb
vendored
Normal file
|
|
@ -0,0 +1,120 @@
|
|||
require 'abstract_unit'
|
||||
|
||||
class QueryStringParsingTest < ActionController::IntegrationTest
|
||||
class TestController < ActionController::Base
|
||||
class << self
|
||||
attr_accessor :last_query_parameters
|
||||
end
|
||||
|
||||
def parse
|
||||
self.class.last_query_parameters = request.query_parameters
|
||||
head :ok
|
||||
end
|
||||
end
|
||||
|
||||
def teardown
|
||||
TestController.last_query_parameters = nil
|
||||
end
|
||||
|
||||
test "query string" do
|
||||
assert_parses(
|
||||
{"action" => "create_customer", "full_name" => "David Heinemeier Hansson", "customerId" => "1"},
|
||||
"action=create_customer&full_name=David%20Heinemeier%20Hansson&customerId=1"
|
||||
)
|
||||
end
|
||||
|
||||
test "deep query string" do
|
||||
assert_parses(
|
||||
{'x' => {'y' => {'z' => '10'}}},
|
||||
"x[y][z]=10"
|
||||
)
|
||||
end
|
||||
|
||||
test "deep query string with array" do
|
||||
assert_parses({'x' => {'y' => {'z' => ['10']}}}, 'x[y][z][]=10')
|
||||
assert_parses({'x' => {'y' => {'z' => ['10', '5']}}}, 'x[y][z][]=10&x[y][z][]=5')
|
||||
end
|
||||
|
||||
test "deep query string with array of hash" do
|
||||
assert_parses({'x' => {'y' => [{'z' => '10'}]}}, 'x[y][][z]=10')
|
||||
assert_parses({'x' => {'y' => [{'z' => '10', 'w' => '10'}]}}, 'x[y][][z]=10&x[y][][w]=10')
|
||||
assert_parses({'x' => {'y' => [{'z' => '10', 'v' => {'w' => '10'}}]}}, 'x[y][][z]=10&x[y][][v][w]=10')
|
||||
end
|
||||
|
||||
test "deep query string with array of hashes with one pair" do
|
||||
assert_parses({'x' => {'y' => [{'z' => '10'}, {'z' => '20'}]}}, 'x[y][][z]=10&x[y][][z]=20')
|
||||
end
|
||||
|
||||
test "deep query string with array of hashes with multiple pairs" do
|
||||
assert_parses(
|
||||
{'x' => {'y' => [{'z' => '10', 'w' => 'a'}, {'z' => '20', 'w' => 'b'}]}},
|
||||
'x[y][][z]=10&x[y][][w]=a&x[y][][z]=20&x[y][][w]=b'
|
||||
)
|
||||
end
|
||||
|
||||
test "query string with nil" do
|
||||
assert_parses(
|
||||
{ "action" => "create_customer", "full_name" => ''},
|
||||
"action=create_customer&full_name="
|
||||
)
|
||||
end
|
||||
|
||||
test "query string with array" do
|
||||
assert_parses(
|
||||
{ "action" => "create_customer", "selected" => ["1", "2", "3"]},
|
||||
"action=create_customer&selected[]=1&selected[]=2&selected[]=3"
|
||||
)
|
||||
end
|
||||
|
||||
test "query string with amps" do
|
||||
assert_parses(
|
||||
{ "action" => "create_customer", "name" => "Don't & Does"},
|
||||
"action=create_customer&name=Don%27t+%26+Does"
|
||||
)
|
||||
end
|
||||
|
||||
test "query string with many equal" do
|
||||
assert_parses(
|
||||
{ "action" => "create_customer", "full_name" => "abc=def=ghi"},
|
||||
"action=create_customer&full_name=abc=def=ghi"
|
||||
)
|
||||
end
|
||||
|
||||
test "query string without equal" do
|
||||
assert_parses({ "action" => nil }, "action")
|
||||
end
|
||||
|
||||
test "query string with empty key" do
|
||||
assert_parses(
|
||||
{ "action" => "create_customer", "full_name" => "David Heinemeier Hansson" },
|
||||
"action=create_customer&full_name=David%20Heinemeier%20Hansson&=Save"
|
||||
)
|
||||
end
|
||||
|
||||
test "query string with many ampersands" do
|
||||
assert_parses(
|
||||
{ "action" => "create_customer", "full_name" => "David Heinemeier Hansson"},
|
||||
"&action=create_customer&&&full_name=David%20Heinemeier%20Hansson"
|
||||
)
|
||||
end
|
||||
|
||||
test "unbalanced query string with array" do
|
||||
assert_parses(
|
||||
{'location' => ["1", "2"], 'age_group' => ["2"]},
|
||||
"location[]=1&location[]=2&age_group[]=2"
|
||||
)
|
||||
end
|
||||
|
||||
private
|
||||
def assert_parses(expected, actual)
|
||||
with_routing do |set|
|
||||
set.draw do |map|
|
||||
map.connect ':action', :controller => "query_string_parsing_test/test"
|
||||
end
|
||||
|
||||
get "/parse", actual
|
||||
assert_response :ok
|
||||
assert_equal(expected, TestController.last_query_parameters)
|
||||
end
|
||||
end
|
||||
end
|
||||
35
vendor/rails/actionpack/test/controller/request/test_request_test.rb
vendored
Normal file
35
vendor/rails/actionpack/test/controller/request/test_request_test.rb
vendored
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
require 'abstract_unit'
|
||||
require 'stringio'
|
||||
|
||||
class ActionController::TestRequestTest < ActiveSupport::TestCase
|
||||
|
||||
def setup
|
||||
@request = ActionController::TestRequest.new
|
||||
end
|
||||
|
||||
def test_test_request_has_session_options_initialized
|
||||
assert @request.session_options
|
||||
end
|
||||
|
||||
Rack::Session::Abstract::ID::DEFAULT_OPTIONS.each_key do |option|
|
||||
test "test_rack_default_session_options_#{option}_exists_in_session_options_and_is_default" do
|
||||
assert_equal(Rack::Session::Abstract::ID::DEFAULT_OPTIONS[option],
|
||||
@request.session_options[option],
|
||||
"Missing rack session default option #{option} in request.session_options")
|
||||
end
|
||||
test "test_rack_default_session_options_#{option}_exists_in_session_options" do
|
||||
assert(@request.session_options.has_key?(option),
|
||||
"Missing rack session option #{option} in request.session_options")
|
||||
end
|
||||
end
|
||||
|
||||
def test_session_id_exists_by_default
|
||||
assert_not_nil(@request.session_options[:id])
|
||||
end
|
||||
|
||||
def test_session_id_different_on_each_call
|
||||
prev_id =
|
||||
assert_not_equal(@request.session_options[:id], ActionController::TestRequest.new.session_options[:id])
|
||||
end
|
||||
|
||||
end
|
||||
146
vendor/rails/actionpack/test/controller/request/url_encoded_params_parsing_test.rb
vendored
Normal file
146
vendor/rails/actionpack/test/controller/request/url_encoded_params_parsing_test.rb
vendored
Normal file
|
|
@ -0,0 +1,146 @@
|
|||
require 'abstract_unit'
|
||||
|
||||
class UrlEncodedParamsParsingTest < ActionController::IntegrationTest
|
||||
class TestController < ActionController::Base
|
||||
class << self
|
||||
attr_accessor :last_request_parameters, :last_request_type
|
||||
end
|
||||
|
||||
def parse
|
||||
self.class.last_request_parameters = request.request_parameters
|
||||
head :ok
|
||||
end
|
||||
end
|
||||
|
||||
def teardown
|
||||
TestController.last_request_parameters = nil
|
||||
end
|
||||
|
||||
test "parses unbalanced query string with array" do
|
||||
assert_parses(
|
||||
{'location' => ["1", "2"], 'age_group' => ["2"]},
|
||||
"location[]=1&location[]=2&age_group[]=2"
|
||||
)
|
||||
end
|
||||
|
||||
test "parses nested hash" do
|
||||
query = [
|
||||
"note[viewers][viewer][][type]=User",
|
||||
"note[viewers][viewer][][id]=1",
|
||||
"note[viewers][viewer][][type]=Group",
|
||||
"note[viewers][viewer][][id]=2"
|
||||
].join("&")
|
||||
|
||||
expected = { "note" => { "viewers"=>{"viewer"=>[{ "id"=>"1", "type"=>"User"}, {"type"=>"Group", "id"=>"2"} ]} } }
|
||||
assert_parses(expected, query)
|
||||
end
|
||||
|
||||
test "parses more complex nesting" do
|
||||
query = [
|
||||
"customers[boston][first][name]=David",
|
||||
"customers[boston][first][url]=http://David",
|
||||
"customers[boston][second][name]=Allan",
|
||||
"customers[boston][second][url]=http://Allan",
|
||||
"something_else=blah",
|
||||
"something_nil=",
|
||||
"something_empty=",
|
||||
"products[first]=Apple Computer",
|
||||
"products[second]=Pc",
|
||||
"=Save"
|
||||
].join("&")
|
||||
|
||||
expected = {
|
||||
"customers" => {
|
||||
"boston" => {
|
||||
"first" => {
|
||||
"name" => "David",
|
||||
"url" => "http://David"
|
||||
},
|
||||
"second" => {
|
||||
"name" => "Allan",
|
||||
"url" => "http://Allan"
|
||||
}
|
||||
}
|
||||
},
|
||||
"something_else" => "blah",
|
||||
"something_empty" => "",
|
||||
"something_nil" => "",
|
||||
"products" => {
|
||||
"first" => "Apple Computer",
|
||||
"second" => "Pc"
|
||||
}
|
||||
}
|
||||
|
||||
assert_parses expected, query
|
||||
end
|
||||
|
||||
test "parses params with array" do
|
||||
query = "selected[]=1&selected[]=2&selected[]=3"
|
||||
expected = { "selected" => [ "1", "2", "3" ] }
|
||||
assert_parses expected, query
|
||||
end
|
||||
|
||||
test "parses params with nil key" do
|
||||
query = "=&test2=value1"
|
||||
expected = { "test2" => "value1" }
|
||||
assert_parses expected, query
|
||||
end
|
||||
|
||||
test "parses params with array prefix and hashes" do
|
||||
query = "a[][b][c]=d"
|
||||
expected = {"a" => [{"b" => {"c" => "d"}}]}
|
||||
assert_parses expected, query
|
||||
end
|
||||
|
||||
test "parses params with complex nesting" do
|
||||
query = "a[][b][c][][d][]=e"
|
||||
expected = {"a" => [{"b" => {"c" => [{"d" => ["e"]}]}}]}
|
||||
assert_parses expected, query
|
||||
end
|
||||
|
||||
test "parses params with file path" do
|
||||
query = [
|
||||
"customers[boston][first][name]=David",
|
||||
"something_else=blah",
|
||||
"logo=#{File.expand_path(__FILE__)}"
|
||||
].join("&")
|
||||
|
||||
expected = {
|
||||
"customers" => {
|
||||
"boston" => {
|
||||
"first" => {
|
||||
"name" => "David"
|
||||
}
|
||||
}
|
||||
},
|
||||
"something_else" => "blah",
|
||||
"logo" => File.expand_path(__FILE__),
|
||||
}
|
||||
|
||||
assert_parses expected, query
|
||||
end
|
||||
|
||||
test "parses params with Safari 2 trailing null character" do
|
||||
query = "selected[]=1&selected[]=2&selected[]=3\0"
|
||||
expected = { "selected" => [ "1", "2", "3" ] }
|
||||
assert_parses expected, query
|
||||
end
|
||||
|
||||
private
|
||||
def with_test_routing
|
||||
with_routing do |set|
|
||||
set.draw do |map|
|
||||
map.connect ':action', :controller => "url_encoded_params_parsing_test/test"
|
||||
end
|
||||
yield
|
||||
end
|
||||
end
|
||||
|
||||
def assert_parses(expected, actual)
|
||||
with_test_routing do
|
||||
post "/parse", actual
|
||||
assert_response :ok
|
||||
assert_equal(expected, TestController.last_request_parameters)
|
||||
end
|
||||
end
|
||||
end
|
||||
103
vendor/rails/actionpack/test/controller/request/xml_params_parsing_test.rb
vendored
Normal file
103
vendor/rails/actionpack/test/controller/request/xml_params_parsing_test.rb
vendored
Normal file
|
|
@ -0,0 +1,103 @@
|
|||
require 'abstract_unit'
|
||||
|
||||
class XmlParamsParsingTest < ActionController::IntegrationTest
|
||||
class TestController < ActionController::Base
|
||||
class << self
|
||||
attr_accessor :last_request_parameters
|
||||
end
|
||||
|
||||
def parse
|
||||
self.class.last_request_parameters = request.request_parameters
|
||||
head :ok
|
||||
end
|
||||
end
|
||||
|
||||
def teardown
|
||||
TestController.last_request_parameters = nil
|
||||
end
|
||||
|
||||
test "parses hash params" do
|
||||
with_test_routing do
|
||||
xml = "<person><name>David</name></person>"
|
||||
post "/parse", xml, default_headers
|
||||
assert_response :ok
|
||||
assert_equal({"person" => {"name" => "David"}}, TestController.last_request_parameters)
|
||||
end
|
||||
end
|
||||
|
||||
test "parses single file" do
|
||||
with_test_routing do
|
||||
xml = "<person><name>David</name><avatar type='file' name='me.jpg' content_type='image/jpg'>#{ActiveSupport::Base64.encode64('ABC')}</avatar></person>"
|
||||
post "/parse", xml, default_headers
|
||||
assert_response :ok
|
||||
|
||||
person = TestController.last_request_parameters
|
||||
assert_equal "image/jpg", person['person']['avatar'].content_type
|
||||
assert_equal "me.jpg", person['person']['avatar'].original_filename
|
||||
assert_equal "ABC", person['person']['avatar'].read
|
||||
end
|
||||
end
|
||||
|
||||
test "logs error if parsing unsuccessful" do
|
||||
with_test_routing do
|
||||
begin
|
||||
$stderr = StringIO.new
|
||||
xml = "<person><name>David</name><avatar type='file' name='me.jpg' content_type='image/jpg'>#{ActiveSupport::Base64.encode64('ABC')}</avatar></pineapple>"
|
||||
post "/parse", xml, default_headers
|
||||
assert_response :error
|
||||
$stderr.rewind && err = $stderr.read
|
||||
assert err =~ /Error occurred while parsing request parameters/
|
||||
ensure
|
||||
$stderr = STDERR
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
test "parses multiple files" do
|
||||
xml = <<-end_body
|
||||
<person>
|
||||
<name>David</name>
|
||||
<avatars>
|
||||
<avatar type='file' name='me.jpg' content_type='image/jpg'>#{ActiveSupport::Base64.encode64('ABC')}</avatar>
|
||||
<avatar type='file' name='you.gif' content_type='image/gif'>#{ActiveSupport::Base64.encode64('DEF')}</avatar>
|
||||
</avatars>
|
||||
</person>
|
||||
end_body
|
||||
|
||||
with_test_routing do
|
||||
post "/parse", xml, default_headers
|
||||
assert_response :ok
|
||||
end
|
||||
|
||||
person = TestController.last_request_parameters
|
||||
|
||||
assert_equal "image/jpg", person['person']['avatars']['avatar'].first.content_type
|
||||
assert_equal "me.jpg", person['person']['avatars']['avatar'].first.original_filename
|
||||
assert_equal "ABC", person['person']['avatars']['avatar'].first.read
|
||||
|
||||
assert_equal "image/gif", person['person']['avatars']['avatar'].last.content_type
|
||||
assert_equal "you.gif", person['person']['avatars']['avatar'].last.original_filename
|
||||
assert_equal "DEF", person['person']['avatars']['avatar'].last.read
|
||||
end
|
||||
|
||||
private
|
||||
def with_test_routing
|
||||
with_routing do |set|
|
||||
set.draw do |map|
|
||||
map.connect ':action', :controller => "xml_params_parsing_test/test"
|
||||
end
|
||||
yield
|
||||
end
|
||||
end
|
||||
|
||||
def default_headers
|
||||
{'CONTENT_TYPE' => 'application/xml'}
|
||||
end
|
||||
end
|
||||
|
||||
class LegacyXmlParamsParsingTest < XmlParamsParsingTest
|
||||
private
|
||||
def default_headers
|
||||
{'HTTP_X_POST_DATA_FORMAT' => 'xml'}
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue