Sha256: 664e090424a260e9e80ad025154eb8aeca87d6ddc098e2c86dadd24ddbc15789
Contents?: true
Size: 1.54 KB
Versions: 1
Compression:
Stored size: 1.54 KB
Contents
require 'spec_helper' describe OtherThingsController, :type => :controller do describe "headers" do it "sets the X-XSS-Protection header" do get :index expect(response.headers['X-XSS-Protection']).to eq(SecureHeaders::XXssProtection::Constants::DEFAULT_VALUE) end it "sets the X-Frame-Options header" do get :index expect(response.headers['X-Frame-Options']).to eq(SecureHeaders::XFrameOptions::Constants::DEFAULT_VALUE) end it "sets the X-WebKit-CSP header" do get :index expect(response.headers['Content-Security-Policy-Report-Only']).to eq("default-src 'self'; img-src data:;") end #mock ssl it "sets the Strict-Transport-Security header" do request.env['HTTPS'] = 'on' get :index expect(response.headers['Strict-Transport-Security']).to eq(SecureHeaders::StrictTransportSecurity::Constants::DEFAULT_VALUE) end it "sets the X-Content-Type-Options header" do get :index expect(response.headers['X-Content-Type-Options']).to eq(SecureHeaders::XContentTypeOptions::Constants::DEFAULT_VALUE) end context "using IE" do it "sets the X-Content-Type-Options header" do request.env['HTTP_USER_AGENT'] = "Mozilla/5.0 (compatible; MSIE 10.6; Windows NT 6.1; Trident/5.0; InfoPath.2; SLCC1; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET CLR 2.0.50727) 3gpp-gba UNTRUSTED/1.0" get :index expect(response.headers['X-Content-Type-Options']).to eq(SecureHeaders::XContentTypeOptions::Constants::DEFAULT_VALUE) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
secure_headers-1.2.0 | fixtures/rails_3_2_12_no_init/spec/controllers/other_things_controller_spec.rb |