Sha256: 32baaa15025067cdfdbe4fb0a96ba5a595f7b3250883b96e76fc05ebcd011ec8
Contents?: true
Size: 1.67 KB
Versions: 33
Compression:
Stored size: 1.67 KB
Contents
# frozen_string_literal: true require "spec_helper" module SecureHeaders describe XXssProtection do specify { expect(XXssProtection.make_header).to eq([XXssProtection::HEADER_NAME, XXssProtection::DEFAULT_VALUE]) } specify { expect(XXssProtection.make_header("1; mode=block; report=https://www.secure.com/reports")).to eq([XXssProtection::HEADER_NAME, "1; mode=block; report=https://www.secure.com/reports"]) } context "with invalid configuration" do it "should raise an error when providing a string that is not valid" do expect do XXssProtection.validate_config!("asdf") end.to raise_error(XXssProtectionConfigError) expect do XXssProtection.validate_config!("asdf; mode=donkey") end.to raise_error(XXssProtectionConfigError) end context "when using a hash value" do it "should allow string values ('1' or '0' are the only valid strings)" do expect do XXssProtection.validate_config!("1") end.not_to raise_error end it "should raise an error if no value key is supplied" do expect do XXssProtection.validate_config!("mode=block") end.to raise_error(XXssProtectionConfigError) end it "should raise an error if an invalid key is supplied" do expect do XXssProtection.validate_config!("123") end.to raise_error(XXssProtectionConfigError) end it "should raise an error if mode != block" do expect do XXssProtection.validate_config!("1; mode=donkey") end.to raise_error(XXssProtectionConfigError) end end end end end
Version data entries
33 entries across 33 versions & 1 rubygems