From 83e35b9c08b97db7605542e69a8fa8d23c7df211 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Mon, 2 May 2011 23:38:39 +0200 Subject: Allow ignore_accept_header through configuration option. --- railties/test/application/configuration_test.rb | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'railties') diff --git a/railties/test/application/configuration_test.rb b/railties/test/application/configuration_test.rb index 8f96f4c57b..b1f7076776 100644 --- a/railties/test/application/configuration_test.rb +++ b/railties/test/application/configuration_test.rb @@ -442,5 +442,26 @@ module ApplicationTests assert_equal [:json], ActionController::Base._wrapper_options[:format] end + + test "config.action_dispatch.ignore_accept_header" do + make_basic_app do |app| + app.config.action_dispatch.ignore_accept_header = true + end + + class ::OmgController < ActionController::Base + def index + respond_to do |format| + format.html { render :text => "HTML" } + format.xml { render :text => "XML" } + end + end + end + + get "/", {}, "HTTP_ACCEPT" => "application/xml" + assert_equal 'HTML', last_response.body + + get "/", { :format => :xml }, "HTTP_ACCEPT" => "application/xml" + assert_equal 'XML', last_response.body + end end end -- cgit v1.2.3