Upgrade to Rails 2.0.2
Upgraded to Rails 2.0.2, except that we maintain vendor/rails/actionpack/lib/action_controller/routing.rb from Rail 1.2.6 (at least for now), so that Routes don't change. We still get to enjoy Rails's many new features. Also fixed a bug in Chunk-handling: disable WikiWord processing in tags (for real this time).
This commit is contained in:
parent
0f6889e09f
commit
6873fc8026
1083 changed files with 52810 additions and 41058 deletions
|
@ -21,11 +21,13 @@ class SendFileController < ActionController::Base
|
|||
def rescue_action(e) raise end
|
||||
end
|
||||
|
||||
SendFileController.template_root = File.dirname(__FILE__) + "/../fixtures/"
|
||||
SendFileController.view_paths = [ File.dirname(__FILE__) + "/../fixtures/" ]
|
||||
|
||||
class SendFileTest < Test::Unit::TestCase
|
||||
include TestFileUtils
|
||||
|
||||
Mime::Type.register "image/png", :png unless defined? Mime::PNG
|
||||
|
||||
def setup
|
||||
@controller = SendFileController.new
|
||||
@request = ActionController::TestRequest.new
|
||||
|
@ -53,6 +55,14 @@ class SendFileTest < Test::Unit::TestCase
|
|||
assert_nothing_raised { response.body.call(response, output) }
|
||||
assert_equal file_data, output.string
|
||||
end
|
||||
|
||||
def test_file_url_based_filename
|
||||
@controller.options = { :url_based_filename => true }
|
||||
response = nil
|
||||
assert_nothing_raised { response = process('file') }
|
||||
assert_not_nil response
|
||||
assert_equal "attachment", response.headers["Content-Disposition"]
|
||||
end
|
||||
|
||||
def test_data
|
||||
response = nil
|
||||
|
@ -65,17 +75,17 @@ class SendFileTest < Test::Unit::TestCase
|
|||
|
||||
def test_headers_after_send_shouldnt_include_charset
|
||||
response = process('data')
|
||||
assert_equal "application/octet-stream", response.headers["Content-Type"]
|
||||
assert_equal "application/octet-stream", response.content_type
|
||||
|
||||
response = process('file')
|
||||
assert_equal "application/octet-stream", response.headers["Content-Type"]
|
||||
assert_equal "application/octet-stream", response.content_type
|
||||
end
|
||||
|
||||
# Test that send_file_headers! is setting the correct HTTP headers.
|
||||
def test_send_file_headers!
|
||||
options = {
|
||||
:length => 1,
|
||||
:type => 'type',
|
||||
:type => Mime::PNG,
|
||||
:disposition => 'disposition',
|
||||
:filename => 'filename'
|
||||
}
|
||||
|
@ -90,7 +100,7 @@ class SendFileTest < Test::Unit::TestCase
|
|||
|
||||
h = @controller.headers
|
||||
assert_equal 1, h['Content-Length']
|
||||
assert_equal 'type', h['Content-Type']
|
||||
assert_equal 'image/png', h['Content-Type']
|
||||
assert_equal 'disposition; filename="filename"', h['Content-Disposition']
|
||||
assert_equal 'binary', h['Content-Transfer-Encoding']
|
||||
|
||||
|
@ -105,13 +115,13 @@ class SendFileTest < Test::Unit::TestCase
|
|||
define_method "test_send_#{method}_status" do
|
||||
@controller.options = { :stream => false, :status => 500 }
|
||||
assert_nothing_raised { assert_not_nil process(method) }
|
||||
assert_equal '500 Internal Server Error', @controller.headers['Status']
|
||||
assert_equal '500 Internal Server Error', @response.headers['Status']
|
||||
end
|
||||
|
||||
define_method "test_default_send_#{method}_status" do
|
||||
@controller.options = { :stream => false }
|
||||
assert_nothing_raised { assert_not_nil process(method) }
|
||||
assert_equal ActionController::Base::DEFAULT_RENDER_STATUS_CODE, @controller.headers['Status']
|
||||
assert_equal ActionController::Base::DEFAULT_RENDER_STATUS_CODE, @response.headers['Status']
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue