Sha256: 25305b25dc9b66238483fe0e28680c42080f121704e87eba3324458f4d10b311

Contents?: true

Size: 1.47 KB

Versions: 33

Compression:

Stored size: 1.47 KB

Contents

# frozen_string_literal: true
require "spec_helper"

module SecureHeaders
  describe XPermittedCrossDomainPolicies do
    specify { expect(XPermittedCrossDomainPolicies.make_header).to eq([XPermittedCrossDomainPolicies::HEADER_NAME, "none"]) }
    specify { expect(XPermittedCrossDomainPolicies.make_header("master-only")).to eq([XPermittedCrossDomainPolicies::HEADER_NAME, "master-only"]) }

    context "valid configuration values" do
      it "accepts 'all'" do
        expect do
          XPermittedCrossDomainPolicies.validate_config!("all")
        end.not_to raise_error
      end

      it "accepts 'by-ftp-filename'" do
        expect do
          XPermittedCrossDomainPolicies.validate_config!("by-ftp-filename")
        end.not_to raise_error
      end

      it "accepts 'by-content-type'" do
        expect do
          XPermittedCrossDomainPolicies.validate_config!("by-content-type")
        end.not_to raise_error
      end
      it "accepts 'master-only'" do
        expect do
          XPermittedCrossDomainPolicies.validate_config!("master-only")
        end.not_to raise_error
      end

      it "accepts nil" do
        expect do
          XPermittedCrossDomainPolicies.validate_config!(nil)
        end.not_to raise_error
      end
    end

    context "invlaid configuration values" do
      it "doesn't accept invalid values" do
        expect do
          XPermittedCrossDomainPolicies.validate_config!("open")
        end.to raise_error(XPCDPConfigError)
      end
    end
  end
end

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
secure_headers-7.0.0 spec/lib/secure_headers/headers/x_permitted_cross_domain_policies_spec.rb
secure_headers-6.7.0 spec/lib/secure_headers/headers/x_permitted_cross_domain_policies_spec.rb
secure_headers-6.6.0 spec/lib/secure_headers/headers/x_permitted_cross_domain_policies_spec.rb
secure_headers-6.5.0 spec/lib/secure_headers/headers/x_permitted_cross_domain_policies_spec.rb
secure_headers-6.4.0 spec/lib/secure_headers/headers/x_permitted_cross_domain_policies_spec.rb
secure_headers-6.3.4 spec/lib/secure_headers/headers/x_permitted_cross_domain_policies_spec.rb
secure_headers-6.3.3 spec/lib/secure_headers/headers/x_permitted_cross_domain_policies_spec.rb
secure_headers-6.3.2 spec/lib/secure_headers/headers/x_permitted_cross_domain_policies_spec.rb
secure_headers-6.3.1 spec/lib/secure_headers/headers/x_permitted_cross_domain_policies_spec.rb
secure_headers-5.2.0 spec/lib/secure_headers/headers/x_permitted_cross_domain_policies_spec.rb
secure_headers-6.3.0 spec/lib/secure_headers/headers/x_permitted_cross_domain_policies_spec.rb
secure_headers-5.1.0 spec/lib/secure_headers/headers/x_permitted_cross_domain_policies_spec.rb
secure_headers-6.2.0 spec/lib/secure_headers/headers/x_permitted_cross_domain_policies_spec.rb
secure_headers-6.1.2 spec/lib/secure_headers/headers/x_permitted_cross_domain_policies_spec.rb
secure_headers-6.1.1 spec/lib/secure_headers/headers/x_permitted_cross_domain_policies_spec.rb
secure_headers-6.1.0 spec/lib/secure_headers/headers/x_permitted_cross_domain_policies_spec.rb
secure_headers-6.0.0 spec/lib/secure_headers/headers/x_permitted_cross_domain_policies_spec.rb
secure_headers-6.0.0.alpha03 spec/lib/secure_headers/headers/x_permitted_cross_domain_policies_spec.rb
secure_headers-6.0.0.alpha02 spec/lib/secure_headers/headers/x_permitted_cross_domain_policies_spec.rb
secure_headers-6.0.0.alpha01 spec/lib/secure_headers/headers/x_permitted_cross_domain_policies_spec.rb