Skip to content

Commit

Permalink
Merge pull request #331 from oskarpearson/ie-compatibility-headers
Browse files Browse the repository at this point in the history
Set X-UA-Compatible HTTP header
  • Loading branch information
pixeltrix committed Jul 20, 2015
2 parents 534c21e + 0c606ea commit e2ba8c6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,7 @@ class Application < Rails::Application
config.action_dispatch.rescue_responses.merge!(
'Site::ServiceUnavailable' => :service_unavailable
)

config.action_dispatch.default_headers.merge!('X-UA-Compatible' => 'IE=edge')
end
end
6 changes: 6 additions & 0 deletions spec/controllers/application_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ def index
end

let(:cache_control) { response.headers['Cache-Control'] }
let(:x_ua_compatible) { response.headers['X-UA-Compatible'] }

it "reloads the site instance on every request" do
expect(Site).to receive(:reload)
Expand All @@ -21,6 +22,11 @@ def index
expect(cache_control).to eq('no-store, no-cache')
end

it "sets X-UA-Compatible control headers" do
get :index
expect(x_ua_compatible).to eq('IE=edge')
end

context "when the site is disabled" do
before do
expect(Site).to receive(:enabled?).and_return(false)
Expand Down

0 comments on commit e2ba8c6

Please sign in to comment.