Permalink
Browse files

ActionController::Base.use_accept_header is not actually used anymore…

…, so let's deprecate it.
  • Loading branch information...
1 parent fb14b8c commit 18bcce596efaa4e77a202431ab5e736001a394c6 Carl Lerche committed Mar 3, 2010
@@ -35,8 +35,14 @@ class << self
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 : ""
@@ -306,12 +306,9 @@ def test_action_cache_with_layout_and_layout_cache_false
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
@@ -145,18 +145,6 @@ def test_change_for_rxml
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
@@ -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
@@ -435,11 +435,4 @@ def stub_request(env = {})
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

0 comments on commit 18bcce5

Please sign in to comment.