Sha256: 6e26c3c672a9209416d306699583ab8dc492fbf19c4d2aa963930b12d2f5d988

Contents?: true

Size: 1.23 KB

Versions: 27

Compression:

Stored size: 1.23 KB

Contents

require 'spec_helper'

module SecureHeaders
  describe StrictTransportSecurity do
    describe "#value" do
      specify { expect(StrictTransportSecurity.make_header).to eq([StrictTransportSecurity::HEADER_NAME, StrictTransportSecurity::DEFAULT_VALUE]) }
      specify { expect(StrictTransportSecurity.make_header("max-age=1234; includeSubdomains; preload")).to eq([StrictTransportSecurity::HEADER_NAME, "max-age=1234; includeSubdomains; preload"]) }

      context "with an invalid configuration" do
        context "with a string argument" do
          it "raises an exception with an invalid max-age" do
            expect do
              StrictTransportSecurity.validate_config!('max-age=abc123')
            end.to raise_error(STSConfigError)
          end

          it "raises an exception if max-age is not supplied" do
            expect do
              StrictTransportSecurity.validate_config!('includeSubdomains')
            end.to raise_error(STSConfigError)
          end

          it "raises an exception with an invalid format" do
            expect do
              StrictTransportSecurity.validate_config!('max-age=123includeSubdomains')
            end.to raise_error(STSConfigError)
          end
        end
      end
    end
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
secure_headers-3.9.0 spec/lib/secure_headers/headers/strict_transport_security_spec.rb
secure_headers-3.8.0 spec/lib/secure_headers/headers/strict_transport_security_spec.rb
secure_headers-3.7.4 spec/lib/secure_headers/headers/strict_transport_security_spec.rb
secure_headers-3.7.3 spec/lib/secure_headers/headers/strict_transport_security_spec.rb
secure_headers-3.7.2 spec/lib/secure_headers/headers/strict_transport_security_spec.rb
secure_headers-3.7.1 spec/lib/secure_headers/headers/strict_transport_security_spec.rb
secure_headers-3.7.0 spec/lib/secure_headers/headers/strict_transport_security_spec.rb
secure_headers-3.6.7 spec/lib/secure_headers/headers/strict_transport_security_spec.rb
secure_headers-3.6.6 spec/lib/secure_headers/headers/strict_transport_security_spec.rb
secure_headers-3.6.5 spec/lib/secure_headers/headers/strict_transport_security_spec.rb
secure_headers-3.6.4 spec/lib/secure_headers/headers/strict_transport_security_spec.rb
secure_headers-3.6.3 spec/lib/secure_headers/headers/strict_transport_security_spec.rb
secure_headers-3.6.2 spec/lib/secure_headers/headers/strict_transport_security_spec.rb
secure_headers-3.6.1 spec/lib/secure_headers/headers/strict_transport_security_spec.rb
secure_headers-3.6.0 spec/lib/secure_headers/headers/strict_transport_security_spec.rb
secure_headers-3.5.1 spec/lib/secure_headers/headers/strict_transport_security_spec.rb
secure_headers-3.5.0 spec/lib/secure_headers/headers/strict_transport_security_spec.rb
secure_headers-3.5.0.pre spec/lib/secure_headers/headers/strict_transport_security_spec.rb
secure_headers-3.4.1 spec/lib/secure_headers/headers/strict_transport_security_spec.rb
secure_headers-3.4.0 spec/lib/secure_headers/headers/strict_transport_security_spec.rb