aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test
diff options
context:
space:
mode:
authorNikita Afanasenko <nafanasenko@spbtv.com>2012-11-01 12:59:10 +0400
committerNikita Afanasenko <nafanasenko@spbtv.com>2012-11-01 15:15:46 +0400
commitd8c1404107501e131e4c7c653794768f5c461793 (patch)
tree08957ebdb7c23f8a3e755cccb8accd63ee9af3b1 /actionpack/test
parentb31ea0c240773c557a6c4e1a0e470a9d442406ee (diff)
downloadrails-d8c1404107501e131e4c7c653794768f5c461793.tar.gz
rails-d8c1404107501e131e4c7c653794768f5c461793.tar.bz2
rails-d8c1404107501e131e4c7c653794768f5c461793.zip
Fix #8086 (BestStandardsSupport rewrites app X-UA-Compatible header, now appends).
Now `BestStandardsSupport` middleware appends it's `X-UA-Compatible` value to app's value. Also test for `BestStandardsSupport` middleware added.
Diffstat (limited to 'actionpack/test')
-rw-r--r--actionpack/test/dispatch/best_standards_support_test.rb34
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