aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarl Lerche <carllerche@mac.com>2010-03-03 09:32:27 -0800
committerCarl Lerche <carllerche@mac.com>2010-03-03 21:24:00 -0800
commit18bcce596efaa4e77a202431ab5e736001a394c6 (patch)
tree890130c084d463539442745ad6ea89d4f05f7c6f
parentfb14b8c6fddae818b2688ac1e584534390c37f72 (diff)
downloadrails-18bcce596efaa4e77a202431ab5e736001a394c6.tar.gz
rails-18bcce596efaa4e77a202431ab5e736001a394c6.tar.bz2
rails-18bcce596efaa4e77a202431ab5e736001a394c6.zip
ActionController::Base.use_accept_header is not actually used anymore, so let's deprecate it.
-rw-r--r--actionpack/lib/action_controller/metal/compatibility.rb10
-rw-r--r--actionpack/test/controller/caching_test.rb3
-rw-r--r--actionpack/test/controller/content_type_test.rb12
-rw-r--r--actionpack/test/controller/mime_responds_test.rb4
-rw-r--r--actionpack/test/dispatch/request_test.rb7
5 files changed, 8 insertions, 28 deletions
diff --git a/actionpack/lib/action_controller/metal/compatibility.rb b/actionpack/lib/action_controller/metal/compatibility.rb
index 93f7b8ca49..d6d8d612a3 100644
--- a/actionpack/lib/action_controller/metal/compatibility.rb
+++ b/actionpack/lib/action_controller/metal/compatibility.rb
@@ -35,8 +35,14 @@ module ActionController
cattr_accessor :resource_action_separator
self.resource_action_separator = "/"
- cattr_accessor :use_accept_header
- self.use_accept_header = true
+ def self.use_accept_header
+ ActiveSupport::Deprecation.warn "ActionController::Base.use_accept_header doesn't do anything anymore. " \
+ "The accept header is always taken into account."
+ end
+
+ def self.use_accept_header=(val)
+ use_accept_header
+ end
self.page_cache_directory = defined?(Rails.public_path) ? Rails.public_path : ""
diff --git a/actionpack/test/controller/caching_test.rb b/actionpack/test/controller/caching_test.rb
index 37f7483427..e42ef85b98 100644
--- a/actionpack/test/controller/caching_test.rb
+++ b/actionpack/test/controller/caching_test.rb
@@ -306,12 +306,9 @@ class ActionCacheTest < ActionController::TestCase
end
def test_action_cache_conditional_options
- old_use_accept_header = ActionController::Base.use_accept_header
- ActionController::Base.use_accept_header = true
@request.env['HTTP_ACCEPT'] = 'application/json'
get :index
assert !fragment_exist?('hostname.com/action_caching_test')
- ActionController::Base.use_accept_header = old_use_accept_header
end
def test_action_cache_with_store_options
diff --git a/actionpack/test/controller/content_type_test.rb b/actionpack/test/controller/content_type_test.rb
index e5ffe20ecc..967107853b 100644
--- a/actionpack/test/controller/content_type_test.rb
+++ b/actionpack/test/controller/content_type_test.rb
@@ -145,18 +145,6 @@ end
class AcceptBasedContentTypeTest < ActionController::TestCase
tests OldContentTypeController
- def setup
- super
- @_old_accept_header = ActionController::Base.use_accept_header
- ActionController::Base.use_accept_header = true
- end
-
- def teardown
- super
- ActionController::Base.use_accept_header = @_old_accept_header
- end
-
-
def test_render_default_content_types_for_respond_to
@request.accept = Mime::HTML.to_s
get :render_default_content_types_for_respond_to
diff --git a/actionpack/test/controller/mime_responds_test.rb b/actionpack/test/controller/mime_responds_test.rb
index 5e34773899..5c1eaf453c 100644
--- a/actionpack/test/controller/mime_responds_test.rb
+++ b/actionpack/test/controller/mime_responds_test.rb
@@ -155,13 +155,11 @@ class RespondToControllerTest < ActionController::TestCase
def setup
super
- ActionController::Base.use_accept_header = true
@request.host = "www.example.com"
end
def teardown
super
- ActionController::Base.use_accept_header = false
end
def test_html
@@ -544,13 +542,11 @@ class RespondWithControllerTest < ActionController::TestCase
def setup
super
- ActionController::Base.use_accept_header = true
@request.host = "www.example.com"
end
def teardown
super
- ActionController::Base.use_accept_header = false
end
def test_using_resource
diff --git a/actionpack/test/dispatch/request_test.rb b/actionpack/test/dispatch/request_test.rb
index 84c06ca113..78200ca17e 100644
--- a/actionpack/test/dispatch/request_test.rb
+++ b/actionpack/test/dispatch/request_test.rb
@@ -435,11 +435,4 @@ protected
def with_set(*args)
args
end
-
- def with_accept_header(value)
- ActionController::Base.use_accept_header, old = value, ActionController::Base.use_accept_header
- yield
- ensure
- ActionController::Base.use_accept_header = old
- end
end