From 26eaf073c4de8276663f927fdeeb91453e8b3956 Mon Sep 17 00:00:00 2001 From: Nicholas Seckar Date: Sun, 26 Feb 2006 17:49:09 +0000 Subject: Remove ::Controllers related cruft; fix AP tests git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3668 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- railties/builtin/controllers/rails_info_controller.rb | 16 +++++++--------- railties/lib/commands/servers/lighttpd.rb | 4 +++- railties/test/dispatcher_test.rb | 11 ----------- railties/test/rails_info_controller_test.rb | 10 ++++------ 4 files changed, 14 insertions(+), 27 deletions(-) (limited to 'railties') diff --git a/railties/builtin/controllers/rails_info_controller.rb b/railties/builtin/controllers/rails_info_controller.rb index ca2801e075..fe3c2d7c5d 100644 --- a/railties/builtin/controllers/rails_info_controller.rb +++ b/railties/builtin/controllers/rails_info_controller.rb @@ -1,11 +1,9 @@ -module Controllers #:nodoc: - class RailsInfoController < ApplicationController - def properties - if local_request? - render :inline => Rails::Info.to_html - else - render :text => '

For security purposes, this information is only available to local requests.

', :status => 500 - end +class RailsInfoController < ApplicationController + def properties + if local_request? + render :inline => Rails::Info.to_html + else + render :text => '

For security purposes, this information is only available to local requests.

', :status => 500 end end -end \ No newline at end of file +end diff --git a/railties/lib/commands/servers/lighttpd.rb b/railties/lib/commands/servers/lighttpd.rb index 4c226c2700..2bd9a1de14 100644 --- a/railties/lib/commands/servers/lighttpd.rb +++ b/railties/lib/commands/servers/lighttpd.rb @@ -30,7 +30,9 @@ unless File.exist?(config_file) source = File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "..", "configs", "lighttpd.conf")) puts "=> #{config_file} not found, copying from #{source}" - FileUtils.cp source, config_file + config = File.read source + config = config.gsub "CWD", File.expand_path(RAILS_ROOT).inspect + File.open(config_file, 'w') { |f| f.write config } end config = IO.read(config_file) diff --git a/railties/test/dispatcher_test.rb b/railties/test/dispatcher_test.rb index bf5d235dfe..41d08e224e 100644 --- a/railties/test/dispatcher_test.rb +++ b/railties/test/dispatcher_test.rb @@ -24,12 +24,10 @@ class DispatcherTest < Test::Unit::TestCase def setup @output = StringIO.new ENV['REQUEST_METHOD'] = "GET" - setup_minimal_environment end def teardown ENV['REQUEST_METHOD'] = nil - teardown_minimal_environment end def test_ac_subclasses_cleared_on_reset @@ -91,13 +89,4 @@ class DispatcherTest < Test::Unit::TestCase def dispatch Dispatcher.dispatch(nil, ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS, @output) end - - def setup_minimal_environment - value = Dependencies::LoadingModule.root - Object.const_set("Controllers", value) - end - - def teardown_minimal_environment - Object.send(:remove_const, "Controllers") - end end diff --git a/railties/test/rails_info_controller_test.rb b/railties/test/rails_info_controller_test.rb index 1488387f3c..6e539f8051 100644 --- a/railties/test/rails_info_controller_test.rb +++ b/railties/test/rails_info_controller_test.rb @@ -8,8 +8,6 @@ require 'action_controller' require 'action_controller/test_process' require 'rails_info' -module Controllers; def self.const_available?(constant); false end end - class ApplicationController < ActionController::Base @local_request = false class << self @@ -29,24 +27,24 @@ end require 'rails_info_controller' # Re-raise errors caught by the controller. -class Controllers::RailsInfoController; def rescue_action(e) raise e end; end +class RailsInfoController; def rescue_action(e) raise e end; end class RailsInfoControllerTest < Test::Unit::TestCase def setup - @controller = Controllers::RailsInfoController.new + @controller = RailsInfoController.new @request = ActionController::TestRequest.new @response = ActionController::TestResponse.new end def test_rails_info_properties_table_rendered_for_local_request - Controllers::RailsInfoController.local_request = true + RailsInfoController.local_request = true get :properties assert_tag :tag => 'table' assert_response :success end def test_rails_info_properties_error_rendered_for_non_local_request - Controllers::RailsInfoController.local_request = false + RailsInfoController.local_request = false get :properties assert_tag :tag => 'p' assert_response 500 -- cgit v1.2.3