Sha256: a424251d5990c798a657aaa5cc78eebba84de2a010eef9a17719c5c61e1a6c6d

Contents?: true

Size: 1.18 KB

Versions: 9

Compression:

Stored size: 1.18 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")).to eq([StrictTransportSecurity::HEADER_NAME, "max-age=1234"]) }

      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

9 entries across 9 versions & 1 rubygems

Version Path
secure_headers-3.0.3 spec/lib/secure_headers/headers/strict_transport_security_spec.rb
secure_headers-3.0.2 spec/lib/secure_headers/headers/strict_transport_security_spec.rb
secure_headers-3.0.1 spec/lib/secure_headers/headers/strict_transport_security_spec.rb
secure_headers-3.0.0 spec/lib/secure_headers/headers/strict_transport_security_spec.rb
secure_headers-3.0.0.rc1 spec/lib/secure_headers/headers/strict_transport_security_spec.rb
secure_headers-3.0.0.pre3 spec/lib/secure_headers/headers/strict_transport_security_spec.rb
secure_headers-3.0.0.pre2 spec/lib/secure_headers/headers/strict_transport_security_spec.rb
secure_headers-3.0.0.pre1 spec/lib/secure_headers/headers/strict_transport_security_spec.rb
secure_headers-3.0.0.pre spec/lib/secure_headers/headers/strict_transport_security_spec.rb