diff options
author | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2012-11-01 04:42:55 -0700 |
---|---|---|
committer | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2012-11-08 20:50:11 -0200 |
commit | 90a5ec758dfb9698ecfd59bd08340ffecbda1d75 (patch) | |
tree | 2d942ebc8433f34600e3af8b18291a298262cb12 /actionpack/test/dispatch/best_standards_support_test.rb | |
parent | 3d25292ae3da2e8cf7a501c69b331a8d08344c59 (diff) | |
download | rails-90a5ec758dfb9698ecfd59bd08340ffecbda1d75.tar.gz rails-90a5ec758dfb9698ecfd59bd08340ffecbda1d75.tar.bz2 rails-90a5ec758dfb9698ecfd59bd08340ffecbda1d75.zip |
Merge pull request #8093 from nikitug/keep_app_x_ua_compatible
Fix #8086 (BestStandardsSupport rewrites app X-UA-Compatible header)
Conflicts:
actionpack/CHANGELOG.md
Diffstat (limited to 'actionpack/test/dispatch/best_standards_support_test.rb')
-rw-r--r-- | actionpack/test/dispatch/best_standards_support_test.rb | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/actionpack/test/dispatch/best_standards_support_test.rb b/actionpack/test/dispatch/best_standards_support_test.rb new file mode 100644 index 0000000000..0737c40a39 --- /dev/null +++ b/actionpack/test/dispatch/best_standards_support_test.rb @@ -0,0 +1,34 @@ +require 'abstract_unit' + +class BestStandardsSupportTest < ActiveSupport::TestCase + def test_with_best_standards_support + _, headers, _ = app(true, {}).call({}) + assert_equal "IE=Edge,chrome=1", headers["X-UA-Compatible"] + end + + def test_with_builtin_best_standards_support + _, headers, _ = app(:builtin, {}).call({}) + assert_equal "IE=Edge", headers["X-UA-Compatible"] + end + + def test_without_best_standards_support + _, headers, _ = app(false, {}).call({}) + assert_equal nil, headers["X-UA-Compatible"] + end + + def test_appends_to_app_headers + app_headers = { "X-UA-Compatible" => "requiresActiveX=true" } + _, headers, _ = app(true, app_headers).call({}) + + expects = "requiresActiveX=true,IE=Edge,chrome=1" + assert_equal expects, headers["X-UA-Compatible"] + end + + private + + def app(type, headers) + app = proc { [200, headers, "response"] } + ActionDispatch::BestStandardsSupport.new(app, type) + end + +end |