aboutsummaryrefslogtreecommitdiffstats
path: root/railties
diff options
context:
space:
mode:
authorSantiago Pastorino <santiago@wyeworks.com>2010-08-13 17:34:20 -0300
committerXavier Noria <fxn@hashref.com>2010-08-14 13:17:31 +0200
commit4c2bbe9a1abfefacda71764ad583c0a302b1fc4e (patch)
tree7dd706c236d08fca6852e8571e08dcca791f2c7b /railties
parente8ffe7d6b6302de789a612be0ad98349b10daa9c (diff)
downloadrails-4c2bbe9a1abfefacda71764ad583c0a302b1fc4e.tar.gz
rails-4c2bbe9a1abfefacda71764ad583c0a302b1fc4e.tar.bz2
rails-4c2bbe9a1abfefacda71764ad583c0a302b1fc4e.zip
Moves local_request? to require.local?
[#5361 state:committed]
Diffstat (limited to 'railties')
-rw-r--r--railties/lib/rails/info_controller.rb2
-rw-r--r--railties/test/rails_info_controller_test.rb10
2 files changed, 7 insertions, 5 deletions
diff --git a/railties/lib/rails/info_controller.rb b/railties/lib/rails/info_controller.rb
index 196eeb4a6c..6b4bdb2921 100644
--- a/railties/lib/rails/info_controller.rb
+++ b/railties/lib/rails/info_controller.rb
@@ -1,6 +1,6 @@
class Rails::InfoController < ActionController::Base
def properties
- if consider_all_requests_local? || local_request?
+ if consider_all_requests_local? || request.local?
render :inline => Rails::Info.to_html
else
render :text => '<p>For security purposes, this information is only available to local requests.</p>', :status => :forbidden
diff --git a/railties/test/rails_info_controller_test.rb b/railties/test/rails_info_controller_test.rb
index 687c2d1568..9d194f41a6 100644
--- a/railties/test/rails_info_controller_test.rb
+++ b/railties/test/rails_info_controller_test.rb
@@ -14,26 +14,28 @@ class InfoControllerTest < ActionController::TestCase
Rails.application.routes.draw do
match '/rails/info/properties' => "rails/info#properties"
end
- @controller.stubs(:consider_all_requests_local? => false, :local_request? => true)
+ @request.stubs(:local? => true)
+ @controller.stubs(:consider_all_requests_local? => false)
@routes = Rails.application.routes
Rails::InfoController.send(:include, @routes.url_helpers)
end
test "info controller does not allow remote requests" do
- @controller.stubs(:consider_all_requests_local? => false, :local_request? => false)
+ @request.stubs(:local? => false)
get :properties
assert_response :forbidden
end
test "info controller renders an error message when request was forbidden" do
- @controller.stubs(:consider_all_requests_local? => false, :local_request? => false)
+ @request.stubs(:local? => false)
get :properties
assert_select 'p'
end
test "info controller allows requests when all requests are considered local" do
- @controller.stubs(:consider_all_requests_local? => true, :local_request? => false)
+ @request.stubs(:local? => false)
+ @controller.stubs(:consider_all_requests_local? => true)
get :properties
assert_response :success
end