Sha256: d46b9311bd2fc1ce5578f40dcc0766bebdb4d0df97e69968056f3b0d85bfbe39

Contents?: true

Size: 1.9 KB

Versions: 11

Compression:

Stored size: 1.9 KB

Contents

module SecureHeaders
  describe XPermittedCrossDomainPolicies do
    specify { expect(XPermittedCrossDomainPolicies.new.name).to eq(XPermittedCrossDomainPolicies::Constants::XPCDP_HEADER_NAME)}
    specify { expect(XPermittedCrossDomainPolicies.new.value).to eq("none")}
    specify { expect(XPermittedCrossDomainPolicies.new('master-only').value).to eq('master-only')}
    specify { expect(XPermittedCrossDomainPolicies.new(:value => 'master-only').value).to eq('master-only') }

    context "valid configuration values" do
      it "accepts 'all'" do
        expect {
          XPermittedCrossDomainPolicies.new("all")
        }.not_to raise_error

        expect {
          XPermittedCrossDomainPolicies.new(:value => "all")
        }.not_to raise_error
      end

      it "accepts 'by-ftp-filename'" do
        expect {
          XPermittedCrossDomainPolicies.new("by-ftp-filename")
        }.not_to raise_error

        expect {
          XPermittedCrossDomainPolicies.new(:value => "by-ftp-filename")
        }.not_to raise_error
      end

      it "accepts 'by-content-type'" do
        expect {
          XPermittedCrossDomainPolicies.new("by-content-type")
        }.not_to raise_error

        expect {
          XPermittedCrossDomainPolicies.new(:value => "by-content-type")
        }.not_to raise_error
      end
      it "accepts 'master-only'" do
        expect {
          XPermittedCrossDomainPolicies.new("master-only")
        }.not_to raise_error

        expect {
          XPermittedCrossDomainPolicies.new(:value => "master-only")
        }.not_to raise_error
      end

      it "accepts nil" do
        expect {
          XPermittedCrossDomainPolicies.new
        }.not_to raise_error
      end
    end

    context 'invlaid configuration values' do

      it "doesn't accept invalid values" do
        expect {
          XPermittedCrossDomainPolicies.new("open")
        }.to raise_error
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
secure_headers-2.3.0 spec/lib/secure_headers/headers/x_permitted_cross_domain_policies_spec.rb
secure_headers-2.2.4 spec/lib/secure_headers/headers/x_permitted_cross_domain_policies_spec.rb
secure_headers-2.2.3 spec/lib/secure_headers/headers/x_permitted_cross_domain_policies_spec.rb
secure_headers-2.2.2 spec/lib/secure_headers/headers/x_permitted_cross_domain_policies_spec.rb
secure_headers-2.2.1 spec/lib/secure_headers/headers/x_permitted_cross_domain_policies_spec.rb
secure_headers-2.2.0 spec/lib/secure_headers/headers/x_permitted_cross_domain_policies_spec.rb
secure_headers-2.1.0 spec/lib/secure_headers/headers/x_permitted_cross_domain_policies_spec.rb
secure_headers-2.0.2 spec/lib/secure_headers/headers/x_permitted_cross_domain_policies_spec.rb
secure_headers-2.0.1 spec/lib/secure_headers/headers/x_permitted_cross_domain_policies_spec.rb
secure_headers-2.0.0 spec/lib/secure_headers/headers/x_permitted_cross_domain_policies_spec.rb
secure_headers-2.0.0.pre2 spec/lib/secure_headers/headers/x_permitted_cross_domain_policies_spec.rb