aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/http
diff options
context:
space:
mode:
authorPratik Naik <pratiknaik@gmail.com>2009-09-30 22:27:02 +0100
committerPratik Naik <pratiknaik@gmail.com>2009-09-30 22:27:02 +0100
commitdd2779e1b83b4d867d47dd286ec0c919f5df12a9 (patch)
tree6e52ea0a329c24429f4d1d41b065e082f0ed6baa /actionpack/lib/action_dispatch/http
parent329b14aa8fdd291a00d17ba12c2e0ab4c3a157cc (diff)
parent420004e030e96f2ace6e27fd622c90ee9e986677 (diff)
downloadrails-dd2779e1b83b4d867d47dd286ec0c919f5df12a9.tar.gz
rails-dd2779e1b83b4d867d47dd286ec0c919f5df12a9.tar.bz2
rails-dd2779e1b83b4d867d47dd286ec0c919f5df12a9.zip
Merge commit 'mainstream/master'
Diffstat (limited to 'actionpack/lib/action_dispatch/http')
-rw-r--r--actionpack/lib/action_dispatch/http/response.rb8
-rw-r--r--actionpack/lib/action_dispatch/http/utils.rb20
2 files changed, 24 insertions, 4 deletions
diff --git a/actionpack/lib/action_dispatch/http/response.rb b/actionpack/lib/action_dispatch/http/response.rb
index e457450059..3e3b473178 100644
--- a/actionpack/lib/action_dispatch/http/response.rb
+++ b/actionpack/lib/action_dispatch/http/response.rb
@@ -3,7 +3,7 @@ require 'active_support/core_ext/module/delegation'
module ActionDispatch # :nodoc:
# Represents an HTTP response generated by a controller action. One can use
- # an ActionController::Response object to retrieve the current state
+ # an ActionDispatch::Response object to retrieve the current state
# of the response, or customize the response. An Response object can
# either represent a "real" HTTP response (i.e. one that is meant to be sent
# back to the web browser) or a test response (i.e. one that is generated
@@ -18,14 +18,14 @@ module ActionDispatch # :nodoc:
# Nevertheless, integration tests may want to inspect controller responses in
# more detail, and that's when Response can be useful for application
# developers. Integration test methods such as
- # ActionController::Integration::Session#get and
- # ActionController::Integration::Session#post return objects of type
+ # ActionDispatch::Integration::Session#get and
+ # ActionDispatch::Integration::Session#post return objects of type
# TestResponse (which are of course also of type Response).
#
# For example, the following demo integration "test" prints the body of the
# controller response to the console:
#
- # class DemoControllerTest < ActionController::IntegrationTest
+ # class DemoControllerTest < ActionDispatch::IntegrationTest
# def test_print_root_path_to_console
# get('/')
# puts @response.body
diff --git a/actionpack/lib/action_dispatch/http/utils.rb b/actionpack/lib/action_dispatch/http/utils.rb
new file mode 100644
index 0000000000..e04a39935e
--- /dev/null
+++ b/actionpack/lib/action_dispatch/http/utils.rb
@@ -0,0 +1,20 @@
+module ActionDispatch
+ module Utils
+ # TODO: Pull this into rack core
+ # http://github.com/halorgium/rack/commit/feaf071c1de743fbd10bc316830180a9af607278
+ def parse_config(config)
+ if config =~ /\.ru$/
+ cfgfile = ::File.read(config)
+ if cfgfile[/^#\\(.*)/]
+ opts.parse! $1.split(/\s+/)
+ end
+ inner_app = eval "Rack::Builder.new {( " + cfgfile + "\n )}.to_app",
+ nil, config
+ else
+ require config
+ inner_app = Object.const_get(::File.basename(config, '.rb').capitalize)
+ end
+ end
+ module_function :parse_config
+ end
+end