diff options
author | Nicholas Seckar <nseckar@gmail.com> | 2006-03-29 15:11:47 +0000 |
---|---|---|
committer | Nicholas Seckar <nseckar@gmail.com> | 2006-03-29 15:11:47 +0000 |
commit | 23fa0395d8d6b0365421b5dea9e5620b95c6b15c (patch) | |
tree | 16702264cc41128a39fd6374af5ba1af81d6a095 | |
parent | b583d23f956ff86d82d24acbb3e641c683251663 (diff) | |
download | rails-23fa0395d8d6b0365421b5dea9e5620b95c6b15c.tar.gz rails-23fa0395d8d6b0365421b5dea9e5620b95c6b15c.tar.bz2 rails-23fa0395d8d6b0365421b5dea9e5620b95c6b15c.zip |
Fix Rails info controller for postgres; Closes #4469.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4097 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
-rw-r--r-- | railties/CHANGELOG | 4 | ||||
-rw-r--r-- | railties/builtin/rails_info/rails/info.rb | 4 | ||||
-rw-r--r-- | railties/builtin/rails_info/rails/info_controller.rb | 16 | ||||
-rw-r--r-- | railties/test/rails_info_controller_test.rb | 22 |
4 files changed, 23 insertions, 23 deletions
diff --git a/railties/CHANGELOG b/railties/CHANGELOG index 28db58e797..9c57222fe4 100644 --- a/railties/CHANGELOG +++ b/railties/CHANGELOG @@ -1,5 +1,9 @@ *SVN* +* Avoid passing escapeHTML non-string in Rails' info controller. [Nicholas Seckar] + +* Fix Rails info controller's tests. [Nicholas Seckar] + * Added gzip compression for JavaScript, CSS, and HTML to default lighttpd.conf [DHH] diff --git a/railties/builtin/rails_info/rails/info.rb b/railties/builtin/rails_info/rails/info.rb index 9ded9e0649..5f8e01c1c3 100644 --- a/railties/builtin/rails_info/rails/info.rb +++ b/railties/builtin/rails_info/rails/info.rb @@ -51,8 +51,8 @@ module Rails def to_html returning table = '<table>' do properties.each do |(name, value)| - table << %(<tr><td class="name">#{CGI.escapeHTML(name)}</td>) - table << %(<td class="value">#{CGI.escapeHTML(value)}</td></tr>) + table << %(<tr><td class="name">#{CGI.escapeHTML(name.to_s)}</td>) + table << %(<td class="value">#{CGI.escapeHTML(value.to_s)}</td></tr>) end table << '</table>' end diff --git a/railties/builtin/rails_info/rails/info_controller.rb b/railties/builtin/rails_info/rails/info_controller.rb index 7534447043..39f8b1f120 100644 --- a/railties/builtin/rails_info/rails/info_controller.rb +++ b/railties/builtin/rails_info/rails/info_controller.rb @@ -1,11 +1,9 @@ -module Rails - class InfoController < ActionController::Base - def properties - if local_request? - render :inline => Rails::Info.to_html - else - render :text => '<p>For security purposes, this information is only available to local requests.</p>', :status => 500 - end +class Rails::InfoController < ActionController::Base + def properties + if local_request? + render :inline => Rails::Info.to_html + else + render :text => '<p>For security purposes, this information is only available to local requests.</p>', :status => 500 end end -end
\ No newline at end of file +end diff --git a/railties/test/rails_info_controller_test.rb b/railties/test/rails_info_controller_test.rb index 6e539f8051..fc14528a1e 100644 --- a/railties/test/rails_info_controller_test.rb +++ b/railties/test/rails_info_controller_test.rb @@ -1,19 +1,22 @@ $:.unshift File.dirname(__FILE__) + "/../lib" -$:.unshift File.dirname(__FILE__) + "/../builtin/controllers" +$:.unshift File.dirname(__FILE__) + "/../builtin/rails_info" $:.unshift File.dirname(__FILE__) + "/../../actionpack/lib" $:.unshift File.dirname(__FILE__) + "/../../activesupport/lib" require 'test/unit' require 'action_controller' require 'action_controller/test_process' -require 'rails_info' -class ApplicationController < ActionController::Base +require_dependency 'rails/info_controller' +class Rails::InfoController < ActionController::Base @local_request = false class << self cattr_accessor :local_request end + # Re-raise errors caught by the controller. + def rescue_action(e) raise e end; + protected def local_request? self.class.local_request @@ -24,27 +27,22 @@ ActionController::Routing::Routes.draw do |map| map.connect ':controller/:action/:id' end -require 'rails_info_controller' - -# Re-raise errors caught by the controller. -class RailsInfoController; def rescue_action(e) raise e end; end - -class RailsInfoControllerTest < Test::Unit::TestCase +class Rails::InfoControllerTest < Test::Unit::TestCase def setup - @controller = RailsInfoController.new + @controller = Rails::InfoController.new @request = ActionController::TestRequest.new @response = ActionController::TestResponse.new end def test_rails_info_properties_table_rendered_for_local_request - RailsInfoController.local_request = true + Rails::InfoController.local_request = true get :properties assert_tag :tag => 'table' assert_response :success end def test_rails_info_properties_error_rendered_for_non_local_request - RailsInfoController.local_request = false + Rails::InfoController.local_request = false get :properties assert_tag :tag => 'p' assert_response 500 |