1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/actionpack/test/dispatch/best_standards_support_test.rb
Nikita Afanasenko d8c1404107 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.
2012-11-01 15:15:46 +04:00

34 lines
957 B
Ruby

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