Sha256: 270ed96aebba79dfb46f13bf8ee166e4ebeca711492503b3e2e2f636c83fcd0c
Contents?: true
Size: 1.26 KB
Versions: 33
Compression:
Stored size: 1.26 KB
Contents
# frozen_string_literal: true 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
33 entries across 33 versions & 1 rubygems