Sha256: 0089119e583f3f3aa15c16db0e4a2c86377ff737ae755df980ddbc1c641c03de

Contents?: true

Size: 1.45 KB

Versions: 36

Compression:

Stored size: 1.45 KB

Contents

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

36 entries across 36 versions & 1 rubygems

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